This is a migrated thread and some comments may be shown as answers.

Client-side grouping

11 Answers 330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 18 Mar 2009, 04:03 PM
Hi,

I have been playing around with the Rad Grid client side support and I am able to make everything work on the client side using the API except for the grouping.  I tried using the groupColumn method of the master table view but it does not work.  I do my binding on the client using the client side API of the radgrid.  I hope you can help me or do anyone has sample code that I can use.

Thanks,
Ryan

11 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Mar 2009, 04:45 AM
Hi Ryan,

I tried Grouping the RadGrid on the client side and it is working well. Try setting the GroupLoadMode property of the Grid to client and see if it works.

ASPX:
  
<MasterTableView  GroupLoadMode="Client" > 

 
<input id="Button1" type="button" value="button"  onclick="Group();" /> 

JS:
   
    function Group()  
      {  
       var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();  
       masterTable.groupColumn("Country");  
         
      }  


Thanks
Shinu





0
Ryan
Top achievements
Rank 1
answered on 19 Mar 2009, 05:45 AM
Hi Shinu,

Thanks for that.  But it still does not work for me.  I actually tried that before.  What it does is that it raises the onCommand client event of the RadGrid.  I can see from the event arguments the GroupByColumn commandName.  So do I need to manually create a group header item and group every item to that group or is it automatically created for me.  Thanks.  Below is my declaration of my radgrid.  Can you also post a sample project where you actually made it work?  Thanks.


<

 

telerik:RadGrid ID="RadGrid1" EnableViewState="false" runat="server" AllowPaging="True" AllowSorting="True" AllowMultiRowSelection="true" AutoGenerateColumns="false" ShowStatusBar="true" ShowFooter="false" ShowHeader="true">

 

 

<MasterTableView DataKeyNames="ForumId" GroupLoadMode="Client" GroupHeaderItemStyle-Font-Size="Small" GroupHeaderItemStyle-HorizontalAlign="Left" EnableNoRecordsTemplate="true" >

 

 

<Columns>

 

 

<telerik:GridClientSelectColumn UniqueName="Select" DataType="System.Boolean" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="1%" />

 

 

<telerik:GridBoundColumn UniqueName="UpdatedOn" HeaderText="<%$ Resources:ForumResource, DateUpdated %>" DataField="UpdatedOn" SortExpression="Dateupdated" DataFormatString="{0:ddMMMyyyy}" ConvertEmptyStringToNull="true" ItemStyle-Width="6%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridBoundColumn UniqueName="UpdatedBy" HeaderText="<%$ Resources:ForumResource, UpdatedBy %>" DataField="UpdatedBy" SortExpression="UpdatedBy" ConvertEmptyStringToNull="true" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridBoundColumn UniqueName="ForumID" HeaderText="<%$ Resources:ForumResource, ForumId %>" DataField="ForumID" SortExpression="ForumID" ConvertEmptyStringToNull="true" ItemStyle-Width="9%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridBoundColumn UniqueName="Topic" HeaderText="<%$ Resources:ForumResource, Topic %>" DataField="Topic" SortExpression="Topic" ConvertEmptyStringToNull="true" ItemStyle-Width="30%" />

 

 

<telerik:GridBoundColumn UniqueName="Category" HeaderText="<%$ Resources:ForumResource, Category %>" DataField="Categorycode" SortExpression="Category" ConvertEmptyStringToNull="true" ItemStyle-Width="8%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridBoundColumn UniqueName="Commentcount" HeaderText="<%$ Resources:ForumResource, CommentCount %>" DataField="Commentcount" SortExpression="Commentcount" DataType=System.Int32 ConvertEmptyStringToNull="true" ItemStyle-Width="4%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridBoundColumn UniqueName="P" HeaderText="<%$ Resources:ForumResource, Priority %>" DataField="P" SortExpression="Priority" ConvertEmptyStringToNull="true" ItemStyle-Width="4%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridBoundColumn UniqueName="Dateopened" HeaderText="<%$ Resources:ForumResource, InitiatedOn %>" DataField="Dateopened" SortExpression="Dateopened" DataFormatString="{0:ddMMMyyyy}" ConvertEmptyStringToNull="true" ItemStyle-Width="6%" ItemStyle-HorizontalAlign="Center" />

 

 

<telerik:GridTemplateColumn UniqueName="InitMod" HeaderText="<%$ Resources:ForumResource, InitMod %>" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" >

 

 

<ItemTemplate><asp:Label ID="lblInitMod" runat="server" /></ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn UniqueName="ModeratedBy" HeaderText="<%$ Resources:ForumResource, Moderator %>" DataField="ModeratedBy" SortExpression="ModeratedBy" ConvertEmptyStringToNull="true" Visible="false" ItemStyle-HorizontalAlign="Left" />

 

 

<telerik:GridBoundColumn UniqueName="InitiatedBy" HeaderText="<%$ Resources:ForumResource, Initiator %>" DataField="InitiatedBy" SortExpression="InitiatedBy" ConvertEmptyStringToNull="true" Visible="false" ItemStyle-HorizontalAlign="Left" />

 

 

<telerik:GridBoundColumn UniqueName="Status" HeaderText="<%$ Resources:ForumResource, Status %>" DataField="Status" SortExpression="Status" ConvertEmptyStringToNull="true" Visible="false" />

 

 

<telerik:GridBoundColumn UniqueName="State" HeaderText="<%$ Resources:ForumResource, State %>" DataField="State" SortExpression="State" ConvertEmptyStringToNull="true" Visible="true" />

 

 

</Columns>

 

 

<NoRecordsTemplate>

 

 

<asp:Label ID="noRecords" runat="server" Text="<%$ Resources:Labels, NoRecords %>"></asp:Label>

 

 

</NoRecordsTemplate>

 

 

</MasterTableView>

 

 

<GroupingSettings GroupContinuesFormatString=" " GroupSplitFormat=" "/>

 

 

<ClientSettings EnableRowHoverStyle="true" Resizing-AllowColumnResize="true" AllowGroupExpandCollapse="false" >

 

 

<Selecting AllowRowSelect="true" />

 

 

<ClientEvents OnRowClick="rowClick" OnCommand="TopicGridOnCommand" OnRowDataBound="TopicGrid_OnRowDataBound"/>

 

 

</ClientSettings>

 

 

<StatusBarSettings LoadingText="<%$ Resources: Labels,Loading%>" ReadyText="<%$ Resources: Labels,Ready%>" />

 

 

<PagerStyle Mode="NextPrevNumericAndAdvanced" ShowPagerText="true" Position="Bottom" AlwaysVisible="true" Wrap="true" PagerTextFormat="Change page: {4} Displaying page {0} of {1}, items {2} to {3} of {5}" />

 

 

</telerik:RadGrid>

 

0
Chris
Top achievements
Rank 1
answered on 06 Jul 2009, 09:35 AM
Hi,

I have same problem. I can not make the grouping work. Here the aspx and code behind code

<asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 
        <telerik:radajaxmanager id="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:radajaxmanager> 
        <telerik:radajaxloadingpanel id="RadAjaxLoadingPanel1" runat="server">  
        </telerik:radajaxloadingpanel> 
        <telerik:radgrid id="RadGrid1" allowmultirowselection="true" allowpaging="true" autogeneratecolumns="false" 
            runat="server" allowsorting="True" gridlines="None" onneeddatasource="RadGrid1_OnNeedDataSource" 
            showgrouppanel="True">  
            <MasterTableView Width="100%" GroupLoadMode="Client" TableLayout="Fixed">            
                <Columns> 
                    <telerik:GridBoundColumn SortExpression="Title" HeaderText="Title" HeaderButtonType="TextButton" 
                        DataField="Title" DataFormatString="{0:d}">  
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings ReorderColumnsOnClient="false" AllowDragToGroup="True" AllowColumnsReorder="True">  
                <Selecting AllowRowSelect="True"></Selecting> 
                <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" 
                    ResizeGridOnColumnResize="False"></Resizing> 
            </ClientSettings> 
        </telerik:radgrid> 


Code Behind

protected void RadGrid1_OnNeedDataSource(object sender, EventArgs e)  
        {  
            DataTable table = new DataTable();  
            table.Columns.Add("Title", typeof(string));  
 
            table.Rows.Add("Record 1");  
            table.Rows.Add("Record 2");  
            table.Rows.Add("Record 3");  
            table.Rows.Add("Record 4");  
            table.Rows.Add("Record 5");  
 
 
            RadGrid1.DataSource = table;  
        } 
0
Sebastian
Telerik team
answered on 06 Jul 2009, 10:21 AM
Hello guys,

@Ryan:
Grouping with client-side binding is not supported in the present version of RadGrid for ASP.NET AJAX. We will consider this feature for implementation for the future releases of the product.

@Chris:
From the grid definition you provided it seems that you omit to set the ClientSettings -> AllowGroupExpandCollapse property to true as shown on this RadGrid demo:

http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/grouploadmodeclient/defaultcs.aspx

Can this be the reason for not being able to expand/collapse groups with GroupLoadMode set to Client?

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ryan
Top achievements
Rank 1
answered on 06 Jul 2009, 12:36 PM
I was able to make client-side grouping work but I did it manually creating and inserting elements inside the grid. 

I hope client-side grouping be implemented soon since it will help a lot of developers who need this feature.
0
Sebastian
Telerik team
answered on 06 Jul 2009, 12:41 PM
Hello Ryan,

We will appreciate if you post your custom solution in this forum thread - it might be reused by other community members while the client-side grouping feature is not available yet. As a token of gratitude we will reward you with Telerik points that can be used as a discount for future upgrades/purchases of our controls.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
TrueThat
Top achievements
Rank 1
answered on 17 Nov 2009, 10:19 PM
Hi Sebastian,
Has this issue been addressed in Q3 2009? If so, where can I find an example?
Thanks,
--Gary
0
Sebastian
Telerik team
answered on 19 Nov 2009, 12:12 PM
Hello TrueThat,

Client-side grouping for RadGrid for ASP.NET AJAX in not implemented yet. We have this feature logged in our product backlog and will consider it for future version of the product.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Aiyaz
Top achievements
Rank 1
answered on 24 Nov 2009, 12:59 AM
Hi Ryan,
Im doing a similar implementation where i have to group and page Json data using RADGrid.  Could you please kind enough to email me your solution or workarround.

My Post:
http://www.telerik.com/community/forums/aspnet/grid/radgrid-client-side-databinding-and-grouping.aspx
0
Jeff
Top achievements
Rank 1
answered on 24 Jun 2014, 05:00 PM
I am also running into the same problem as Ryan. Has grouping with client-side binding yet been added in the latest release? Or is there a suitable workaround for this? 
0
Pavlina
Telerik team
answered on 27 Jun 2014, 12:27 PM
Hi,

I am happy to inform you that our developers are currently implementing client-side grouping and it will be available for the next official release of UI for ASP.NET AJAX (Q3 2014).
 
Regards,
Pavlina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ryan
Top achievements
Rank 1
Chris
Top achievements
Rank 1
Sebastian
Telerik team
TrueThat
Top achievements
Rank 1
Aiyaz
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or