Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1190
Refresh summary calculations when using grouping
posted

I have a grid that is handling real-time data from the network and I allow the user to group and sum the data.  Because the grid doesn't automatically recalculate the summary calculations i have to call RefreshSummaries on the RowsManagerBase class.  But doing this doesn't work when grouping so I have to traverse all of the row managers by iterating the rows and grabbing the GroupByRows and calling their managers.  This works but seems to use alot of CPU.  I have a grid with about 1000 rows which the user groups into about 100 groups (100 rows per group).  I have a timer and I am doing my RefreshSummaries every 2 seconds but it still uses enough CPU to where the grid lags significantly.  Is there a better way to recalculate the summary information when using grouping?

Parents
No Data
Reply
  • 34510
    Offline posted

    Hi John,

    The reason the XamGrid does not automatically refresh the summaries is for performance reasons.  If the data was to be updated quite frequently, the data would need to be iterated and summaries recalculated.  This is very expensive to do as you can see.

    It sounds like your application is refreshing the summaries for every group all at once.  A better approach might be to stagger the updates so that the application isn't hitting the cpu with a ton of work all at once.  Spread out the updates over a longer period of time and you should see better performance.  Maybe update two groups at a time and then wait a few milliseconds and then update the next two groups.  To the user it will look like the summaries are updated almost instantly (users might still see some quickly changing numbers as the summaries are updated) but to the cpu there is more time to update summaries and still keep the UI responsive.  The idea is to spread out the updates over the course of a few 100 milliseconds rather than doing it all at once.

Children