Oct 22, 2010, 1:34 PM
[CLOSED] Problem using GridPanel with EditableGrid, GroupingView and GroupCommands
Hi,
My program is throwing an exception when I use a GridPanel combined with EditableGrid, GroupingView and GroupCommands.
To identify the errors follow these steps:
1) Click a menu item in the group command 'Aprov'
OR
2) Change the value of the column 'Aproved' to 'Yes', focus any other control, change the value to 'No' and focus any other control.
It seems to be a cache error, but I don't know how to solve. This error only apears if I use the '<ext:CommandColumn />' tag. When this block is commented everything works fine.
My program is throwing an exception when I use a GridPanel combined with EditableGrid, GroupingView and GroupCommands.
To identify the errors follow these steps:
1) Click a menu item in the group command 'Aprov'
OR
2) Change the value of the column 'Aproved' to 'Yes', focus any other control, change the value to 'No' and focus any other control.
It seems to be a cache error, but I don't know how to solve. This error only apears if I use the '<ext:CommandColumn />' tag. When this block is commented everything works fine.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Document", typeof(string));
table.Columns.Add("Date", typeof(DateTime));
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Guid", typeof(string));
table.Columns.Add("Value", typeof(double));
string doc = null;
Random r = new Random();
for (int i = 0; i < 50; i++ )
{
if (i % 10 == 0)
doc = "ABC-123456";
else if (i% 3 == 0)
doc = "RGSDWD-155";
else
doc = "QWERQRT-44";
table.Rows.Add(doc, DateTime.Today, i, Guid.NewGuid().ToString(), 1000 * r.NextDouble());
}
storeTest.DataSource = table;
storeTest.DataBind();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function Aprov(command, groupId, records)
{
for(var i=0;i< records.length;i++)
{
if(command == 'aprov-yes')
records[i].set('Aprov', 'Yes');
else
records[i].set('Aprov', 'No');
records[i].commit();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="grdTest" runat="server" Width="950" Height="500" >
<Store>
<ext:Store ID="storeTest" runat="server" GroupField="Document">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="Document" Type="String" />
<ext:RecordField Name="Date" Type="Date" />
<ext:RecordField Name="ID" Type="Int" />
<ext:RecordField Name="Guid" Type="String" />
<ext:RecordField Name="Value" Type="Float" />
<ext:RecordField Name="Aprov" Type="String" />
<ext:RecordField Name="Notes" Type="String" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:GroupingSummaryColumn DataIndex="Document" Header="Document" Groupable="true" SummaryType="None">
<Renderer Handler="return 'DOCUMENT >> ' + record.data.Document;" />
</ext:GroupingSummaryColumn>
<%--<ext:Column Header="Document" DataIndex="Document" Width="200" />--%>
<ext:DateColumn Header="Date" DataIndex="Date" Width="70" />
<ext:Column Header="ID" DataIndex="ID" Width="30" />
<ext:Column Header="GUID" DataIndex="Guid" Width="140" />
<ext:NumberColumn Header="Value" DataIndex="Value" Width="75" Align="Right" />
<ext:Column Header="Aproved" DataIndex="Aprov" Width="40">
<Editor>
<ext:ComboBox runat="server" Editable="false" ForceSelection="false">
<Items>
<ext:ListItem Text=" " Value="" />
<ext:ListItem Text="Yes" Value="Yes" />
<ext:ListItem Text="No" Value="No" />
</Items>
</ext:ComboBox>
</Editor>
</ext:Column>
<ext:Column Header="Notes" DataIndex="Notes" >
<Editor>
<ext:TextField runat="server" />
</Editor>
</ext:Column>
<%--WHEN THIS BLOCK IS COMMENTED EVERYTHING WORKS FINE--%>
<ext:CommandColumn Hidden="true" >
<GroupCommands>
<ext:CommandFill />
<ext:GridCommand Text="Aprov" StandOut="false">
<Menu>
<Items>
<ext:MenuCommand CommandName="aprov-yes" Text="Yes" />
<ext:MenuCommand CommandName="aprov-no" Text="No" />
</Items>
</Menu>
</ext:GridCommand>
</GroupCommands>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<Listeners>
<GroupCommand Handler="Aprov(command, groupId, records);" />
</Listeners>
<View>
<ext:GroupingView runat="server" ForceFit="true" MarkDirty="false" ShowGroupName="false" HideGroupedColumn="true" />
</View>
<Plugins>
<ext:EditableGrid ID="EditableGrid1" runat="server" />
</Plugins>
</ext:GridPanel>
</form>
</body>
</html>
Last edited by Daniil; Oct 22, 2010 at 3:30 PM.
Reason: [CLOSED]