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

Server Side Grouping

3 Answers 238 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 13 Jan 2012, 07:20 PM
My requirements are to have sorting, pagination and grouping of the data done on the server-side.  With advanced data-binding, and custom pagination, via the NeedDataSource event, I'm able to easily do the sorting on the entire dataset and use pagination information to slice the data to send to the client.  However the issue is how to deal with grouping on the server side so that the RadGrid can display it.

I've looked through the demos, tutorials, documentation, forum, etc. and haven't seen anything on it, so if I've missed something please let me know.  One reference I came across is in the "limitation" section of the http://www.telerik.com/help/aspnet/grid/grdbasicgrouping.html document.

Has anyone dealt with this issue, have any ideas or advice?


3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 17 Jan 2012, 04:56 PM
Chris:

Not sure if you saw this forum thread yet, but it should provide some insights for you.
Client-side databinding with grouping

It provides a suggestion of setting GroupLoadMode property to Client so that groups will be expanded client side without postbacks. And, according to MVP Kevin Babcock:

"The GroupLoadMode property allows you to expand your grouped rows on the client, or by posting back to the server (the default behavior). However, because this server-side property works with data that is bound on the server, it will not function correctly when used with the client-side databinding feature of the RadGrid."

Hope this helps!
0
Tsvetina
Telerik team
answered on 18 Jan 2012, 09:40 AM
Hi Chris,

If you want to have grouping working correctly in RadGrid, you would need to turn off custom paging when grouping takes place, so that the grid can group over the whole datasource. You can see how this is done in the code-behind of this demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx

Also, have in mind that there were improvements on RadGrid grouping in Q3 2011, so now thanks to a new LINQ-based grouping mechanism, the feature is a lot faster than the "old" version:
http://blogs.telerik.com/blogs/posts/11-11-08/super-charged-performance-optimizations-for-telerik-s-asp-net-ajax-grid-in-q3-2011.aspx

Kind regards,
Tsvetina
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
Chris
Top achievements
Rank 1
answered on 18 Jan 2012, 10:02 PM
Tsvetina thanks for the response.  As to the demo, that was one of the ones I checked out to get the custom pagination working.  I had not seen that blog, but I found it interesting but still I'm not convinced that all the data should be brought down from the datasource to the server; not only performance reasons but also because of potentially stale data. 

Nonetheless what I ended up doing is the following:

a) Using custom paging and providing the NeedDataSource event to fetch data
b) Captured changes to the grouping via the GroupsChanging event and cached information away, since information stored in the RadGrid is unreliable after a GroupsChanging event occurs.
b) Adapted the fetch data to do the following
i) Apply filtering
ii) Apply sorting by grouping based on information cached from GroupsChanging, or RadGrid itself.
iii) Apply sorting by ordering based on information from RadGrid itself.
iv) Apply pagination requirements

From testing, that seems to get what my requirements are, i.e. a) only pull from data source necessary data based on filters, b) apply grouping and sorting to all data based on filters.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Tsvetina
Telerik team
Chris
Top achievements
Rank 1
Share this question
or