Hi,
I am working on an application that uses an ultrawingrid attached to a DataView
which is subsequently looking at a DataTable.
I am making use of the ultragrid group by facility to aggregate the figures in the grid.
However, I have some concerns over the performance of using group by. The data in the DataTable
could potentially be updated many times a second. Another option is to use another DataTable with a
data relation to the previous table and use the "expression" property on a column to do the summations.
However, doing this increases the complexity slightly and I lose some of the flexibility of doing it via the grid.
What do you recommend? I have read the article on performance tips (http://news.infragistics.com/forums/t/15306.aspx)
which will no doubt help. Are there any issues with regard to performance of using the group by in a grid?
Many thanks
It's hard for me to be specific here without knowing more about the needs of your application.
When the data source is updated, the grid cell's will reflect the changes as long as the data source implements IBindingList and notifies the grid of the change. This should not be a problem since you are using a DataView.
However, the grid will not re-sort or re-group the data when it receives this notification. The grid works this way for a couple of reasons. One is that it would be a weird user experience for a user to enter a value in a cell, tab out of that cell, and have the row suddenly disappear or for the grid to scroll to a new position. Another reason is for a situation like you have here.
To make the grid re-sort or re-group, you have to use the band.SortedColumns.RefreshSort method. This allow you to have total control over when the grouping and sorting is refreshed.
My guess is that if you were to respond to the notifications from your data source and refresh the sorting on the grid multiple times per second, it would certainly be a huge performance problem and the application would be unusable.
Is the data that is changing going to affect the grouping at all? If so, the question is, how often do you want the grid to refresh the grouping? Perhaps you could use a timer and do this every few seconds. This could still be a problem if you have a lot of rows, as the application might freeze every time the sorting is refreshed.
Hi Mike,
thanks for the response. In this application the user will not be editing any data in the grid but
the numbers in the datasource will change frequently. Here is a bit more detail (heavily simplified):
For example, the DataTable will have 3 columns.
Column1: an item name
Column2: a categorisation for that item
Column3: a running total for that item (that will change frequently)
In many cases the user will want to see the totals (column3) summed by the categorisation (i.e. column 2),
for example, by grouping by column 2 in the grid.
Each category will have many items under it. The category of an item may change but it will be very
infrequent so it sounds like if this does happen then I can call the RefreshSort method as you mentioned.
My concern is that the totals (column 3) for a particular item will be changing frequently and I want to ensure that
the performance of the group by in the grid is good enough to automatically recalculate the totals for the group bys with the application
still being usable. If not then I may have to use the DataRelation option described previously and perform the
summing in the datasource using an expression column (I would rather not). Any thoughts? Thanks
inmana said:I am not using a calcmanager. Should I?
It's hard to say for sure, but I think the CalcManager would probably be more effiicient because it performs tha calculations asynchonously. The down side of this is that summaries may not always be in synch with the values on the screen. For example, you might change several values in the DataSource and the actual grid will will update to display the new values, but the summaries will not neccessarily be calculated immedaitely - they might lag behind a little bit.
I am not using a calcmanager. Should I? There are no formulas as such in the grid.
I am just using the summaries facility that the grid provides. As a result when you do a group by,
each group by row has the sum of all the totals under a category which updates automatically as
the figures in the DataTable are changed. I guess the question is whether this is more or less
perfomant than doing the summations via another DataTable using a datarelation and an expression
in the data table etc.
thanks
How are you perofrming the totals calculations?
Again, it's really hard to say how performant it will be, since there are so many factors at work here. I would think that if you are using CalcManager to calculate the totals in a summary, then it should be fine, since CalcManager is optimized to calculate the visible cells in the grid first. this means that the grid will only be calculating a few summaries at a time, anyway.
But the only way to really know is to try it out and see.