Grouping and paging on collapse

3 posts, 0 answers
  1. Aurelio Righetti
    Aurelio Righetti avatar
    51 posts
    Member since:
    May 2009

    Posted 15 Mar 2010 Link to this post

    Hi all,
    i have a problem with the grouping and paging, radgrid is AllowPaging="True" and  PageSize="20", then grouping for column "Comune",
    I get the result of Figure 1, but I want to get the result of Figure 2 without going to page 18.
    I have seen the post:

    http://www.telerik.com/community/forums/aspnet-ajax/grid/grouping-and-paging-on-collapse.aspx

    but I could not get the desired result.

    can get the result of Fig.2 when I run the grouping for the columns "Comune" ?

    Please if possible help me with an example.

    Tnks Aurelio

    This is the definition of the radgrid:
                   <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
                AutoGenerateColumns="False" DataSourceID="CliAgeSqlDataSource" EnableLinqExpressions="False" 
                PageSize="20" ShowGroupPanel="True" GridLines="None" Height="462px" AllowFilteringByColumn="True" 
                Skin="Outlook" ondetailtabledatabind="RadGrid1_DetailTableDataBind"  
                onitemdatabound="RadGrid1_ItemDataBound"  
                onitemcommand="RadGrid1_ItemCommand"
                <grouppanel text="Trascina l'intestazione di una colonna e rilasciala qui per effettuare il raggruppamento delle righe."
                </grouppanel> 
                <pagerstyle pagertextformat="Cambia Pagina: {4} &amp;nbsp;Page &lt;strong&gt;{0}&lt;/strong&gt; of &lt;strong&gt;{1}&lt;/strong&gt;, items &lt;strong&gt;{2}&lt;/strong&gt; to &lt;strong&gt;{3}&lt;/strong&gt; of &lt;strong&gt;{5}&lt;/strong&gt;."/> 
                <mastertableview datakeynames="GruAziId,CliForCod,CliForTip" datasourceid="CliAgeSqlDataSource" 
                    allowcustomsorting="false" showgroupfooter="True"  
                    clientdatakeynames="CliForCod"  GroupLoadMode="Client" TableLayout="Fixed"
                    ...... 
                    <SortExpressions> 
                        <telerik:GridSortExpression FieldName="CliForRagSoc" /> 
                    </SortExpressions> 
                    <PagerStyle FirstPageToolTip="Prima pagina" LastPageToolTip="Ultima pagina" NextPagesToolTip="Pagine successive"  
                        NextPageToolTip="Pagina successiva"  
                        PagerTextFormat="Cambia pagina: {4} &amp;nbsp;Pagina &lt;strong&gt;{0}&lt;/strong&gt; di &lt;strong&gt;{1}&lt;/strong&gt;, righe dal &lt;strong&gt;{2}&lt;/strong&gt; a &lt;strong&gt;{3}&lt;/strong&gt; di &lt;strong&gt;{5}&lt;/strong&gt;."  
                        PrevPagesToolTip="Pagine precedenti" PrevPageToolTip="Pagina precedente" /> 
                </mastertableview> 
                <groupingsettings collapsetooltip="Nascondi gli ordini."  
                    expandtooltip="Visualizza i primi 15 ordini del cliente"  
                    GroupContinuedFormatString="... il gruppo continua dalla pagina precedente. "  
                    GroupContinuesFormatString="Il gruppo continua nella pagina precedente"  
                    GroupSplitDisplayFormat="Record visualizzati {0} di {1} "  
                    ShowUnGroupButton="True"  
                    UnGroupButtonTooltip="Clicca qui per cancellare il raggruppamento"  
                    UnGroupTooltip="Trascina fuori dalla barra per cancellare il raggruppamento." /> 
                <clientsettings allowcolumnsreorder="True" reordercolumnsonclient="True" allowdragtogroup="True"
                                   <Selecting AllowRowSelect="True" /> 
                                   <ClientEvents OnRowClick="RowClick" /> 
                                   <Scrolling ScrollHeight="300px" AllowScroll="True" UseStaticHeaders="True" EnableVirtualScrollPaging="false" /> 
                    <Resizing AllowColumnResize="True" /> 
                </clientsettings> 
                <sortingsettings sortedasctooltip="Ordinamento Ascendente." sortedbackcolor="LemonChiffon" 
                    sorteddesctooltip="Ordinamento Discendente." sorttooltip="Clicca qui per ordinare la griglia." /> 
                <hierarchysettings collapsetooltip="Clicca per chiudere" expandtooltip="Clicca per espandere" /> 
                <StatusBarSettings LoadingText="Caricamento..." ReadyText="Pronto" /> 
            </telerik:RadGrid> 

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Mar 2010 Link to this post

    Hi,

    As mentioned by Telerik this is the default behaviour of the grid to dispaly the grouped items in different pages and the desired solution would be to dynamically change the page size on grouping.Take a look at the code below and let me know how it goes.

    C#
         protected void RadGrid1_GroupsChanging(object source, GridGroupsChangingEventArgs e) 
            { 
                if(e.Action == GridGroupsChangingAction.Group) 
                { 
                     
                    RadGrid1.MasterTableView.PageSize = RadGrid1.MasterTableView.PageSize * RadGrid1.MasterTableView.PageCount; 
                    RadGrid1.Rebind(); 
                } 
     
                else if (e.Action == GridGroupsChangingAction.Ungroup) 
                { 
                    RadGrid1.MasterTableView.PageSize = 10; 
                    RadGrid1.Rebind(); 
                     
                } 
                 
          } 

        protected void RadGrid1_PreRender(object sender, EventArgs e) 
            { 
                foreach (GridGroupHeaderItem headerItem in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader)) 
                { 
                    headerItem.Expanded = false
                } 
            } 


    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Aurelio Righetti
    Aurelio Righetti avatar
    51 posts
    Member since:
    May 2009

    Posted 16 Mar 2010 Link to this post

    Hi Princy, thnks for the tips, is work fine, but is very very slow:

      RadGrid1.MasterTableView.PageSize * RadGrid1.MasterTableView.PageCount = 3200

    The viewState is too big and is for this problem that i use the paging set to 20.

    Tnks Aurelio
Back to Top