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

Grid Virtual Paging + Aggregates

2 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justavian
Top achievements
Rank 1
Justavian asked on 18 Jan 2013, 03:59 PM
How can we get accurate numbers out for aggregates applied to a grid with virtual paging enabled?

I've recently switched over a grid to virtual paging.  Before, the code would just select everything and let the control work out what to display and how to deal with groups and aggregates.  However, many of my customers were running into issues (understandably) with large tables - those containing a few hundred thousand or more.  The grid was taking forever to display / group / page / etc.

Now, the grid is very high performance, thanks to the new MSSQL 2012 OFFSET... FETCH NEXT statement - it's about time they implemented that!  While it's high performance, i've now lost the ability to do grouping and aggregates correctly.  It will only summarize what is on the current page.  Certainly that makes sense - there's no way for the telerik grid to read data it hasn't been handed.

So - how do i correct this?  I don't need a full-blown example, but rather just a quick push in the right direction.  Is there a function i can override to deal with the groups / aggregates manually?  Is that the right choice?  Any help here would be appreciated!

Thanks!

-RP

2 Answers, 1 is accepted

Sort by
0
Accepted
Angel Petrov
Telerik team
answered on 23 Jan 2013, 05:06 PM
Hello Rich,

Thank you for contacting Telerik Support.

I am sorry to say but this is not a valid scenario. RadGrid calculates aggregates over the entire data source. This means that if you set as a data source only a subset of the records calculations will be made only for this subset and not for the whole data source because as you said, RadGrid does not have access to the rest of the data.
A possible resolution for the problem is to handle things manually. You can try implementing the functionality using following these steps:
  1. Intercept OnItemDataBound event and check if the item is a GridFooterItem
  2. If the upper-mentioned condition is true make a request to the database and get the aggregated values manually.
  3. Populate the footer item with the new data.
Note that the implementation of this approach will require some custom code to be added to the project but you should be able to retain the performance.
Do not hesitate to contact us again if you have any further questions.

Kind regards,
Angel Petrov
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
Justavian
Top achievements
Rank 1
answered on 23 Jan 2013, 05:11 PM
Angel,

Thank you very much for your response.  I already have *very* customized versions of your grids, so i'm quite familiar with how to add a few bits as you had suggested.  I was mostly just looking for a direction - and you've provided that with the OnItemDataBound.  I had anticipated that this might be the event i would have to work with - i just wasn't sure if there was an easier way.

Thanks for your help!  i'll experiment with building the aggregates manually.

-RP
Tags
Grid
Asked by
Justavian
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Justavian
Top achievements
Rank 1
Share this question
or