PDA

View Full Version : [CLOSED] GridPanel Hidden Column



cwolcott
Jun 11, 2012, 2:46 PM
There seems to be a problem with columns that are hidden in grid panels. So in the behind code the standard configuration is:



<ext:NumberColumn runat="server" Text="CFDB Version" DataIndex="CfdbVer" Width="75" Align="Center" Hidden="True" Format="00" />


When the browser displays the GridPanel I select Columns->CFDB Version to display the column, but when I go back to hide it the Columns->CFDB Version is greyed out.

I performed an additional text by defining a second column to be hidden. And again I can enable either column to be shown via the browser, but I can not select them to be hidden unless both a selected to be shown.

I assume there is a counter problem in the ext.net code.

cwolcott
Jun 11, 2012, 3:27 PM
Here is some additional details.

I configured my five columns in the following manner:

C1 - hidden=true;
C2 - hideable=false;
C3 - hideable=false;
C4 - hideable=false;
C5 - hideable=false;

If you look at the typical GridPanel it will not let you hide the last column. So since I have 4 columns that are not hideable only C1 shows in the list and it will not let me re-hide the column.

Daniil
Jun 11, 2012, 8:33 PM
Hi Chris,

Thanks for the report. We will investigate.

Here is the example to reproduce.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new object[] { "test1", "test2", "test3" },
new object[] { "test4", "test5", "test6" },
new object[] { "test7", "test8", "test9" },
};
store.DataBind();
}
}
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
<ext:ModelField Name="test3" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test1" DataIndex="test1" Hidden="true" />
<ext:Column runat="server" Text="Test2" DataIndex="test2" Hideable="false" />
<ext:Column runat="server" Text="Test3" DataIndex="test3" Hideable="false" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</body>
</html>

cwolcott
Jun 13, 2012, 2:01 PM
Any update on this issue?

Daniil
Jun 13, 2012, 5:13 PM
I will report it to Sencha.

For now I can suggest the following fix.

Fix

<script type="text/javascript">
Ext.grid.header.Container.override({
getLeafMenuItems: function() {
var me = this,
columns = me.getGridColumns(),
items = [],
i = 0,
count = 0,
len = columns.length,
menu = me.getMenu(),
item;

for (; i < len; ++i) {
item = columns[i];
if (item.hideable) {
item = me.getMenuItemForHeader(menu, item);
if (item) {
items.push(item);
if (item.checked) {
++count;
}
}
// THE FIX
} else if (!item.hidden) {
++count;
}
// END OF THE FIX
}

return {
items: items,
checkedCount: count
};
}
});
</script>

Daniil
Jun 13, 2012, 5:42 PM
The Sencha thread:
http://www.sencha.com/forum/showthread.php?219758

cwolcott
Jun 13, 2012, 6:50 PM
Thanks. The patch works great for my issue.

cwolcott
Jun 14, 2012, 5:07 PM
The patch works great. You can close this thread. Hopefully Sencha will fix it on their end.

Daniil
Jun 14, 2012, 5:26 PM
Thanks for the update.

I would leave the thread unclosed for now till a permanent fix will appear either in ExtJS or Ext.NET.

Daniil
Aug 27, 2012, 7:57 AM
Sencha appears to fixed it. I think you can remove the patch now.

Thanks again for the report!