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

  1. #1

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

    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}.disable();" />
                                                        </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
    Last edited by Daniil; Jun 11, 2013 at 9:42 AM. Reason: [CLOSED]
  2. #2
    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/#...showSummaryRow

    Here is an example how to toggle it on the fly.
    https://examples2.ext.net/#/GridPane...oupingSummary/
  3. #3
    Quote Originally Posted by Daniil View Post
    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/#...showSummaryRow

    Here is an example how to toggle it on the fly.
    https://examples2.ext.net/#/GridPane...oupingSummary/
    ok. I just overmissed it when copy-pasting. Everything work like it should. Thanks @Daniil. Thread can be closed.

Similar Threads

  1. Replies: 4
    Last Post: Jan 21, 2013, 7:23 AM
  2. Replies: 0
    Last Post: Oct 21, 2011, 3:04 AM
  3. [CLOSED] Remote grouping or grouping summary for GridPanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 08, 2009, 10:23 PM
  4. [CLOSED] Grid/Store DataBind to Jagged Object Array
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 03, 2009, 4:49 PM
  5. [CLOSED] How to create array object in codebehind
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 09, 2008, 6:20 AM

Tags for this Thread

Posting Permissions