PDA

View Full Version : [CLOSED] [#345] GridPanel header fails when double click column resizer



RCN
Sep 16, 2013, 12:25 PM
On IE 9 and FireFox 17, the GridPanel's header disappear when double click the column resizer, when there is no data loaded.

http://forums.ext.net/attachment.php?attachmentid=6898&stc=1

http://forums.ext.net/attachment.php?attachmentid=6899&stc=1

Any ideas to overcome this issue?


<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<script type="text/javascript">
var loadRecords = function () {
App._str.loadPage(1);
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Button Text="Load Records" runat="server">
<Listeners>
<Click Handler="loadRecords();" />
</Listeners>
</ext:Button>
<ext:GridPanel runat="server" Title="Records" Frame="false" Width="500" Height="500">
<Store>
<ext:Store AutoLoad="false" ID="_str" runat="server">
<Proxy>
<ext:AjaxProxy Url="/Example/LoadFakeRecords/">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="ID" Type="String" />
<ext:ModelField Name="Name" Type="String" />
<ext:ModelField Name="Address" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column Text="ID" DataIndex="ID" runat="server" />
<ext:Column Text="Name" DataIndex="Name" runat="server" />
<ext:Column Text="Address" DataIndex="Address" runat="server" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</body>
</html>





namespace SandBox.Controllers
{
public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}

public StoreResult LoadFakeRecords()
{
List<Person> lst = new List<Person>();

for (int index = 0; index < 15; index++)
{
lst.Add(new Person
{
ID = index,
Name = string.Format("Name{0}", index)
});
}

return new StoreResult(lst, lst.Count());
}
}

public class Person
{
public int ID { get; set; }

public string Name { get; set; }
}
}


Thanks in advance

Daniil
Sep 16, 2013, 4:01 PM
Hi Raphael,

Thank you for the report.

Reported to Sencha for now.
http://www.sencha.com/forum/showthread.php?271992

It crashes in IE9 and FireFox, but not in Chrome.

RCN
Sep 16, 2013, 4:40 PM
Thank you Daniil. Please keep posted about any update regarding this issue

Daniil
Sep 17, 2013, 4:26 AM
Sencha opened a bug. We created an Issue to track it.
https://github.com/extnet/Ext.NET/issues/345

Please use this fix for now.

FIX

Ext.view.Table.override({
getMaxContentWidth: function(header) {
var me = this,
cells = me.el.query(header.getCellInnerSelector()),
originalWidth = header.getWidth(),
i = 0,
ln = cells.length,
hasPaddingBug = Ext.supports.ScrollWidthInlinePaddingBug,
columnSizer = me.body.select(me.getColumnSizerSelector(header)),
max = Math.max,
paddingAdjust = 0,
maxWidth;

if (hasPaddingBug && ln > 0) {
paddingAdjust = me.getCellPaddingAfter(cells[0]);
}

// Set column width to 1px so we can detect the content width by measuring scrollWidth
columnSizer.setWidth(1);

// Allow for padding round text of header
maxWidth = header.textEl.dom.offsetWidth + header.titleEl.getPadding('lr');
for (; i < ln; i++) {
maxWidth = max(maxWidth, cells[i].scrollWidth);
}
if (hasPaddingBug) {
// in some browsers, the "after" padding is not accounted for in the scrollWidth
maxWidth += paddingAdjust;
}

// 40 is the minimum column width. TODO: should this be configurable?
maxWidth = max(maxWidth, 40);

// Set column width back to original width
columnSizer.setWidth(originalWidth);

return maxWidth;
}
});

RCN
Sep 17, 2013, 2:10 PM
Thank you Daniil

RCN
Jan 21, 2015, 4:05 PM
I confirm that this issue has been fixed in the SVN trunk. It will go to v3.1.0 beta release.

RCN
Jan 21, 2015, 4:28 PM
Daniil, if you agree, please mark this thread as closed.