PDA

View Full Version : [CLOSED] Strange behavior of grid row when cells contains cells command



feanor91
May 04, 2012, 10:02 AM
Hello

see that code :


<%@ 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[] { "group1", "1", "1" },
****************new object[] { "group1", "11", "11" },
****************new object[] { "group1", "111", "111" },
****************new object[] { "group2", "2", "2" },
****************new object[] { "group2", "22", "22" },
****************new object[] { "group2", "222", "222" }
************};
************store.DataBind();
Store store2 = this.GridPanel2.GetStore();
store2.DataSource = new object[]
************{
****************new object[] { "group1", "1", "1" },
****************new object[] { "group1", "11", "11" },
****************new object[] { "group1", "111", "111" },
****************new object[] { "group2", "2", "2" },
****************new object[] { "group2", "22", "22" },
****************new object[] { "group2", "222", "222" }
************};
store2.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 id="Head1" runat="server">
****<title>Ext.NET v2 Example</title>
</head>
<body>
****<ext:ResourceManager ID="ResourceManager1" runat="server" />

<ext:TabPanel runat="server">
<Items>
<ext:Panel ID="Panel1" runat="server">
<Content>
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
******** <Store>
************ <ext:Store ID="Store1" runat="server" GroupField="groupId">
**************** <Model>
******************** <ext:Model ID="Model1" runat="server">
************************ <Fields>
**************************** <ext:ModelField Name="groupId" />
**************************** <ext:ModelField Name="test1" />
**************************** <ext:ModelField Name="test2" />
************************ </Fields>
******************** </ext:Model>
**************** </Model>
************ </ext:Store>
******** </Store>
******** <ColumnModel ID="ColumnModel1" runat="server">
************ <Columns>
**************** <ext:Column ID="Column1" runat="server" Text="GroupId" DataIndex="groupId">
</ext:Column>
**************** <ext:Column ID="Column2" runat="server" Text="Test1" DataIndex="test1" >
<Commands>
<ext:ImageCommand CommandName="Edit" Icon="NoteAdd">
<ToolTip Text="add a comment" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Target" Icon="ControlRecord">
<ToolTip Text="Add/modify target" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Measured" Icon="Eye">
<ToolTip Text="Measured/Estimated value" />
</ext:ImageCommand>
</Commands>
</ext:Column>
**************** <ext:Column ID="Column3" runat="server" Text="Test2" DataIndex="test2" >
<Commands>
<ext:ImageCommand CommandName="Edit" Icon="NoteAdd">
<ToolTip Text="add a comment" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Target" Icon="ControlRecord">
<ToolTip Text="Add/modify target" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Measured" Icon="Eye">
<ToolTip Text="Measured/Estimated value" />
</ext:ImageCommand>
</Commands>
</ext:Column>
************ </Columns>
******** </ColumnModel>
******** <Features>
************ <ext:Grouping ID="Grouping1" runat="server" StartCollapsed="false" />
******** </Features>
******** <Listeners>
************ <%--Workaround--%>
************ <ViewReady Handler="this.features[0].expandAll();" />
******** </Listeners>
**** </ext:GridPanel>
</Content>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server">
<Content>
<ext:GridPanel ID="GridPanel2" runat="server" AutoHeight="true">
******** <Store>
************ <ext:Store ID="Store2" runat="server" GroupField="groupId">
**************** <Model>
******************** <ext:Model ID="Model2" runat="server">
************************ <Fields>
**************************** <ext:ModelField Name="groupId" />
**************************** <ext:ModelField Name="test1" />
**************************** <ext:ModelField Name="test2" />
************************ </Fields>
******************** </ext:Model>
**************** </Model>
************ </ext:Store>
******** </Store>
******** <ColumnModel ID="ColumnModel2" runat="server">
************ <Columns>
**************** <ext:Column ID="Column4" runat="server" Text="GroupId" DataIndex="groupId" />
**************** <ext:Column ID="Column5" runat="server" Text="Test1" DataIndex="test1" />
**************** <ext:Column ID="Column6" runat="server" Text="Test2" DataIndex="test2" />
************ </Columns>
******** </ColumnModel>
******** <Features>
************ <ext:Grouping ID="Grouping2" runat="server" StartCollapsed="false" />
******** </Features>
******** <Listeners>
************ <%--Workaround--%>
************ <ViewReady Handler="this.features[0].expandAll();" />
******** </Listeners>
**** </ext:GridPanel>
</Content>
</ext:Panel>
</Items>
</ext:TabPanel>
****
****<ext:Button ID="Button1"
********runat="server"
********Text="Expand the first group">
********<Listeners>
************<Click Handler="#{GridPanel1}.features[0].expand('group1');" />
********</Listeners>***
****</ext:Button>
*
****<ext:Button ID="Button2"
********runat="server"
********Text="Expand the second group">
********<Listeners>
************<Click Handler="#{GridPanel1}.features[0].expand('group2');" />
********</Listeners>***
****</ext:Button>
</body>
</html>
First change pane to show the grid (I don't know why they are not shown at launch, but it is not the bug). In first grid, remove one column, change pane and come again on first pane. See the row height. If you hide groupId column, nothing happen because it have no cell command, but with other cells bug happen.

If cells contains cells command and grids are in tab panel, then when changing panel when column are hidden conduct to grid rows not drawn with good height (without changig column size of course).

If you unhide hiden column, then the drawing is good.

(why I have stars in the code? it is the first time I see that...)

Daniil
May 04, 2012, 12:13 PM
Hi,

Can I remove the following thread as it looks to be a duplicate?
http://forums.ext.net/showthread.php?18777

feanor91
May 04, 2012, 12:21 PM
Oh...Seems I made a mistake...Of course you can

Daniil
May 04, 2012, 1:26 PM
I can't run the code dye to these '*' in the code. Could you re-format?

feanor91
May 04, 2012, 2:31 PM
I can't run the code dye to these '*' in the code. Could you re-format?

Please se :


(why I have stars in the code? it is the first time I see that...)

Else do a replace all "*" by "space", I try to made my copy several times and I always ave the stars. I retry :



<%@ 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[] { "group1", "1", "1" },
new object[] { "group1", "11", "11" },
new object[] { "group1", "111", "111" },
new object[] { "group2", "2", "2" },
new object[] { "group2", "22", "22" },
new object[] { "group2", "222", "222" }
};
store.DataBind();
Store store2 = this.GridPanel2.GetStore();
store2.DataSource = new object[]
{
new object[] { "group1", "1", "1" },
new object[] { "group1", "11", "11" },
new object[] { "group1", "111", "111" },
new object[] { "group2", "2", "2" },
new object[] { "group2", "22", "22" },
new object[] { "group2", "222", "222" }
};
store2.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 id="Head1" runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />

<ext:TabPanel ID="TabPanel1" runat="server">
<Items>
<ext:Panel ID="Panel1" runat="server">
<Content>
<ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
<Store>
<ext:Store ID="Store1" runat="server" GroupField="groupId">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="groupId" />
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="GroupId" DataIndex="groupId">
</ext:Column>
<ext:Column ID="Column2" runat="server" Text="Test1" DataIndex="test1" >
<Commands>
<ext:ImageCommand CommandName="Edit" Icon="NoteAdd">
<ToolTip Text="add a comment" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Target" Icon="ControlRecord">
<ToolTip Text="Add/modify target" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Measured" Icon="Eye">
<ToolTip Text="Measured/Estimated value" />
</ext:ImageCommand>
</Commands>
</ext:Column>
<ext:Column ID="Column3" runat="server" Text="Test2" DataIndex="test2" >
<Commands>
<ext:ImageCommand CommandName="Edit" Icon="NoteAdd">
<ToolTip Text="add a comment" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Target" Icon="ControlRecord">
<ToolTip Text="Add/modify target" />
</ext:ImageCommand>
<ext:ImageCommand CommandName="Measured" Icon="Eye">
<ToolTip Text="Measured/Estimated value" />
</ext:ImageCommand>
</Commands>
</ext:Column>
</Columns>
</ColumnModel>
<Features>
<ext:Grouping ID="Grouping1" runat="server" StartCollapsed="false" />
</Features>
<Listeners>
<%--Workaround--%>
<ViewReady Handler="this.features[0].expandAll();" />
</Listeners>
</ext:GridPanel>
</Content>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server">
<Content>
<ext:GridPanel ID="GridPanel2" runat="server" AutoHeight="true">
<Store>
<ext:Store ID="Store2" runat="server" GroupField="groupId">
<Model>
<ext:Model ID="Model2" runat="server">
<Fields>
<ext:ModelField Name="groupId" />
<ext:ModelField Name="test1" />
<ext:ModelField Name="test2" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:Column ID="Column4" runat="server" Text="GroupId" DataIndex="groupId" />
<ext:Column ID="Column5" runat="server" Text="Test1" DataIndex="test1" />
<ext:Column ID="Column6" runat="server" Text="Test2" DataIndex="test2" />
</Columns>
</ColumnModel>
<Features>
<ext:Grouping ID="Grouping2" runat="server" StartCollapsed="false" />
</Features>
<Listeners>
<%--Workaround--%>
<ViewReady Handler="this.features[0].expandAll();" />
</Listeners>
</ext:GridPanel>
</Content>
</ext:Panel>
</Items>
</ext:TabPanel>

<ext:Button ID="Button1"
runat="server"
Text="Expand the first group">
<Listeners>
<Click Handler="#{GridPanel1}.features[0].expand('group1');" />
</Listeners>
</ext:Button>

<ext:Button ID="Button2"
runat="server"
Text="Expand the second group">
<Listeners>
<Click Handler="#{GridPanel1}.features[0].expand('group2');" />
</Listeners>
</ext:Button>
</body>
</html>

Ah, works in preview post function, I copy/pase from pspad this time.

Daniil
May 04, 2012, 4:10 PM
First change pane to show the grid (I don't know why they are not shown at launch, but it is not the bug).


Please use Items instead of Content.



In first grid, remove one column, change pane and come again on first pane. See the row height. If you hide groupId column, nothing happen because it have no cell command, but with other cells bug happen.

If cells contains cells command and grids are in tab panel, then when changing panel when column are hidden conduct to grid rows not drawn with good height (without changig column size of course).

If you unhide hiden column, then the drawing is good.

Reproduced. We are investigating.


(why I have stars in the code? it is the first time I see that...)

Yes, sometimes it happens. I'm not sure why. At least I have never reproduced that behavior. Maybe, it is related to what you are coping the code from.

And yes, copy, paste to some simple redactor first like NotePad commonly helps.

Daniil
May 04, 2012, 9:39 PM
The problem appears to be difficult to fix immediately. It will take some time.

We will notice you when we will come up with a fix.

feanor91
May 05, 2012, 5:06 AM
OK, no problem, I will wait.

Daniil
May 08, 2012, 3:10 PM
The fix has been added to SVN. Please update and re-test.

feanor91
May 09, 2012, 9:22 AM
Hello

It works perfectly, thank you very much.