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
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
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.