views:

1710

answers:

2

I have a Infragistics UltraGrid using a bindingSource.

If I add a new object to my binding list, it adds a row to the bottom of the grid which is fine if there's no user defined sort.

Question is if the user clicks on a column header to sort the grid, is there a way for new rows to appear in the proper sorted order instead of always on the bottom?

Re-sorting all rows on every insert is too expensive.

+3  A: 

Seems kind of ghetto. Infragistics support also indicated that the RefreshSortPosition() method is the only choice.

// Add to binding list which will trigger a row to be added to the bound ultragrid.
this.bindingList.Add(new Person("Smith", "John"));

// Get length since we know this will always be added to the end
int length = this.ultraGrid.Rows.All.Length;

// Get it to sort
this.ultraGrid.Rows[length - 1].RefreshSortPosition();

To be a bit more efficient, you can always be clever by disable redrawing, etc and then call refresh on a bunch of rows after a batch of orders, etc...

Hope that helps. I had very little luck Googling this problem.

debugme
A: 

It helped ME. Thanks