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

Set RadGrid to keep pagesize when groups are collapsed

7 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 23 May 2011, 08:08 AM
Hi,

I have a question about the RadGrid when you use both paging and grouping. If all the groups are expanded it works fine. But if i collapse a couple of groups, the rowcount of the group are still counted as if they where expanded?

For instance if I have 5 groups with 10 rows each and a pagesize of 20. When I start the page all the groups are expanded, and the first page is shown with 2 groups of 10 rows each. That is good beacuse I want to show 20 rows on each page. But then if I have a "Collapse All"-button that I press, there is only 2 rows showing on my first page? The 2 groups collapsed is only 2 rows but is counted as if thay where expanded?

Is there any way to solve this? I want the page to show as much data as I have set in the pagesize.

This is my grid (I have tried both Client and Server GroupLoadMode):

 

 

<telerik:RadGrid ID="RadGridBuyWarrants" runat="server"

 

 

 

 

OnNeedDataSource="RadGridBuyWarrants_NeedDataSource" AutoGenerateColumns="false"

 

 

 

 

AllowSorting="true" AllowPaging="true" PageSize="20"

 

 

 

 

ShowGroupPanel="false" onitemcommand="RadGridBuyWarrants_ItemCommand"

 

 

 

 

onitemdatabound="RadGridBuyWarrants_ItemDataBound">

 

 

 

<PagerStyle Mode="NumericPages" />

 

 

 

 

<ClientSettings AllowGroupExpandCollapse="True" AllowDragToGroup="True" AllowColumnsReorder="True"/>

 

 

 

<MasterTableView Width="100%" GroupLoadMode="Server">

 


This is my expand/collapse all code:

 

 

foreach (GridItem item in RadGridBuyWarrants.MasterTableView.Controls[0].Controls)

 

 

{

 

 

 

if (item is GridGroupHeaderItem)

 

 

{

 

item.Expanded =

 

true;

 

 

}

 

}


Would be very greatful if anyone could help me solve this.

7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 23 May 2011, 10:19 AM
Hi Robert,

Due to the current implementation of the RadGrid control this functionality could not be implemented. However, you could achieve the desired functionality by using our new RadTreeList control.

Please excuse us for the inconvenience this might cause you.

Best wishes,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Robert
Top achievements
Rank 1
answered on 23 May 2011, 01:41 PM
Hi,

ok, the treeview seems to have the right functionality.

But to get it to work I have to make big modifications on my datasource? It has to be in parent/child format? And if I want aggregations in the header I have to do them manually before it is databound? So that the parent has calculated data on the parent-level of the datasource?
0
Pavlina
Telerik team
answered on 24 May 2011, 01:40 PM
Hello Robert,

RadTreeList is used to display self-hierarchical data in a grid style. When configuring it, you need to set the DataKeyNames and the ParentDataKeyNames properties. Please, refer to the help article below for more information about the treelist structure:

Regarding aggregates, note that calculated total values can only be displayed in the footer item at the end of each level.
http://demos.telerik.com/aspnet-ajax/treelist/examples/columns/aggregates/defaultcs.aspx

All the best,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
AratiS
Top achievements
Rank 1
answered on 04 Mar 2013, 08:38 PM
Has this issue with Radgrid been resolved? I am having a similar issue but would like to use Radgrid instead of TreeList. Please let me know if there is any workaround for this.

Appreciate any response.

Thanks,
Arati
0
Pavlina
Telerik team
answered on 07 Mar 2013, 03:54 PM
Hello Arati,

Are you talking about the behaviour which is described in the first post of the forum thread? If so, note that with the current implementation of RadGrid control this is not possible. For more information on the subject you can refer to the forum thread below:
http://www.telerik.com/community/forums/aspnet-ajax/grid/collapsing-group-collapses-all-items.aspx

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
John
Top achievements
Rank 1
answered on 28 Jan 2015, 01:10 AM
I have a similar question about the RadGrid when you use both paging and grouping. If all the groups are expanded it works fine. But if I start collapsing groups, the page count stays the same, leaving the page mostly blank.  To see the remaining groups, I must go to the next page. I would expect that as I collapse groups, the other expanded groups would put themselves directly under collapsed groups.

For instance if I have 15 groups with 1- 300 rows each, a pagesize of 50, across 63 pages. When I start the page all the groups are expanded, and the first page is shown with 2 groups, with rows continuing onto the next page.  But when I start collapsing groups, the first page only has 2 rows for each group header.  The rest of the first page is blank, and I still have 63 pages.  If I collapse all, I would expect to see a continuous list of group headings. 

Is there any way to solve this? I want the page to show as many group heading rows as I have set in the pagesize.

0
Pavlina
Telerik team
answered on 02 Feb 2015, 09:39 AM
Hello,

The required functionality is not supported by the RadGrid control. Grouping could be applied only on the items rendered on the current page. As you noticed when you start collapsing groups, the first page only has 2 rows for each group header, this is so because the items on the next pages are not available at this time and they can not be displayed on the first page. This behavior depends on the RadGrid implicit grouping logic and currently there are no scheduled plans to modify this behavior.

Please excuse us for the inconvenience caused.

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
Robert
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Robert
Top achievements
Rank 1
AratiS
Top achievements
Rank 1
John
Top achievements
Rank 1
Share this question
or