I have a ultrawingrid binded to a datatable through bindingsource. If I add new rows to the underlying data-table its populating the grid appropriately. The problem is when I add a new row to the datatable & grid has sorting on 1 field & grouping also in the other field. The new row is not getting sorted within the group.
If i remove the grouping, then I can place it properly by calling RefreshSortPosition() on the bottom row. But its not working with the grouping on (probably because of the grouping as it will not be last row).
Is there a way to sort the new row properly inside the group ?
Hi,
coolpkb said:If i remove the grouping, then I can place it properly by calling RefreshSortPosition() on the bottom row. But its not working with the grouping on (probably because of the grouping as it will not be last row).
You can't do this using RefreshSortPosition on the row, but you should be able to make it work by refreshing the sorting on the whole band.
this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.RefreshSort(true);
If that doesn't work, please let me know which version of the grid you are using. There was a bug in this method which was fixed a while back, so you might need to get the latest Service Release.
How to get the latest service release - Infragistics Community
Mike,
Thanks for your reply. But I do not want to collapse my groups. Is there a way to find the most recent row added to the grid ? I was thinking of performing RefreshSortPostion on that OR if there is any other way to achieve it.
Mike - I have even tried that RowSynchronization & BeginLoadData (as mentioned by you in the performance guide) but it doesn't works with Grouping.
I guess I got it working. I'm converting the newly added datarow to the UltraGridRow by using the GetRowWithListIndex function. Then I'm performing the RefreshSortPosition on it & its working fine. Testing it more & will update in case of any new things found.
Hm, I didn't realize that refreshing the sorting would collapse the groups.
Using GetRowWithListIndex seems like a good idea.
If that doesn't work, another alternative would be to try to store the state of the grid rows (expanded, active, selected, and maybe the scroll position) and then try to restore it after the refresh. But your solution is obviously a lot easier.