PDA

View Full Version : [CLOSED] Grouping GridPanel loading only last item from object array and summary row always visible.



ViDom
Jun 10, 2013, 10:58 AM
Hi,
Like in title.

Here is sample to reproduce:


<%@ Page Language="C#" %>
<%@ Register tagPrefix="ext" namespace="Ext.Net" assembly="Ext.Net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

private object[] objList = new object[]
{
new {Id = 1, ListName = "1-st group", PropertyName = "First", Visible = true, Editable = true},
new {Id = 1, ListName = "1-st group", PropertyName = "Second", Visible = true, Editable = true},
new {Id = 1, ListName = "2-nd group", PropertyName = "First", Visible = true, Editable = true},
new {Id = 1, ListName = "2-nd group", PropertyName = "Second", Visible = true, Editable = true}
};
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
StoreSetGrid.DataSource = objList;
StoreSetGrid.DataBind();
}
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager runat="server"></ext:ResourceManager>
<ext:Viewport runat="server" ID="mainSetting">
<LayoutConfig>
<ext:VBoxLayoutConfig runat="server" Align="Stretch"/>
</LayoutConfig>
<Items>
<ext:Container Layout="FitLayout" ID="bl1" runat="server">
<Items>
<ext:Panel ID="PanelMainSettingsList" runat="server" Layout="Accordion" Header="false" Collapsible="false" Flex="1">
<Items>
<ext:Panel ID="GridPanelSettingsList" runat="server" Title="Konfiguracja list" AutoScroll="true" Collapsed="true">
<LayoutConfig>
<ext:VBoxLayoutConfig runat="server" Align="Stretch" />
</LayoutConfig>
<Items>
<ext:GridPanel ID="GridPanelSetGrid" runat="server" Layout="Fit" Header="false" Title="Sample"
AutoHeight="true" AutoScroll="true" AutoExpandColumn="ListName" Flex="1">
<Store>
<ext:Store ID="StoreSetGrid" runat="server"
GroupField="ListName">
<Model>
<ext:Model ID="Model1" IDProperty="Id" runat="server">
<Fields>
<ext:ModelField Name="Id" Type="Int" runat="server"/>
<ext:ModelField Name="ListName" Type="String" />
<ext:ModelField Name="PropertyName" Type="String" />
<ext:ModelField Name="Visible" Type="Boolean" />
<ext:ModelField Name="Editable" Type="Boolean" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Listeners>
<ValidateEdit Handler="#{ButtonSubmit}.enable();" />
</Listeners>
<Plugins>
<ext:CellEditing ID="CellEditing1" runat="server" ClicksToEdit="1" />
</Plugins>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="ListName" Text="Table" DataIndex="ListName" MenuDisabled="true" />
<ext:Column runat="server" ID="PropertyName" Text="Property Name" DataIndex="PropertyName" MenuDisabled="True"></ext:Column>
<ext:CheckColumn ID="Visible" Text="Visible" DataIndex="Visible" Width="60"
Editable="true" MenuDisabled="true" ></ext:CheckColumn>
</Columns>
</ColumnModel>
<Features>
<ext:GroupingSummary ID="group" runat="server" GroupHeaderTplString="{name}" HideGroupedHeader="true" EnableGroupingMenu="false" />
</Features>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModelSetGrid" runat="server" SingleSelect="true" />
</SelectionModel>
</ext:GridPanel>
<ext:Panel runat="server" ID="buttonpanelSettings" Header="false" Height="100" Border="false" StyleSpec="margin: 10px 0px; text-align: center;">
<Buttons>
<ext:Button ID="ButtonSubmit" runat="server" Text="Save" Icon="Disk">
<Listeners>
<Click Handler="#{GridPanelSetGrid}.submitData();#{ButtonSubmit}.d isable();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:Container>
</Items>
</ext:Viewport>
</body>
</html>


There is also problem with summary row (always visible). How should I hide before showing grid ?

Thanks,
ViDom

Daniil
Jun 10, 2013, 12:42 PM
Hi @ViDom,

1. You should provide unique value for the ModelField which you are using as a Model's IDProperty.

2. Please use a GroupingSummary's ShowSummaryRow property.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.feature.GroupingSummary-cfg-showSummaryRow

Here is an example how to toggle it on the fly.
http://examples2.ext.net/#/GridPanel/Locking_Grid/GroupingSummary/

ViDom
Jun 11, 2013, 10:37 AM
Hi @ViDom,

1. You should provide unique value for the ModelField which you are using as a Model's IDProperty.

2. Please use a GroupingSummary's ShowSummaryRow property.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.feature.GroupingSummary-cfg-showSummaryRow

Here is an example how to toggle it on the fly.
http://examples2.ext.net/#/GridPanel/Locking_Grid/GroupingSummary/

ok. I just overmissed it when copy-pasting. Everything work like it should. Thanks @Daniil. Thread can be closed.