I have a grid with the outlook group by turned on. My grid has about a dozen rows and I select a column to group by that leaves anywhere from 2 to 5 rows in a group. I expand a group that contains 3 rows and I delete the row that is displayed in the middle. I wasn't sure what to expect with my groups after I did this. If I use the RefreshSort on the SortedColumnsCollection then all of my groups are set to collapsed but the grid data is correct. Using RefreshSortPosition on the individuals rows doesn't seem to refresh the grid correctly (I get a bogus 3rd record). I have seen a couple other posts regarding the RefreshSortPosition not working correctly if rows are grouped. Is this a bug? And I've also seen a few posts about the groups automatically collapsing with the RefreshSort. I'd post code but we are running Infragistic controls through third-party language with a CLR bridge.
Does anyone have an example of how they handled this situation? I can keep track of all of my expanded groups and their value before refreshing the grid's data but I can't think of a good grid event to hang my hat on to put this logic so I don't have to write it for every grid in our app.
Infragistics WinForms 20092.2017
bheavican said:I'm deleting the row in the dataset and re-binding.
What kind of data source are you binding to the grid to?
If you are using a robust data source that implement IBindingList, then you do not need to rebind the grid. If at all possible, I would strongly advise you to do that, because re-binding the grid is a very destructive process and your grid will lose all state information like selection and expansion of rows and there is no way to avoid that.
If you are using a weaker data source that only implements IList, then you can probably still avoid re-binding the grid by simply calling grid.Rows.Refresh(ReloadData) on the grid after deleting the row.
Maybe i'm doing something wrong here. I think I left this piece out earlier. I'm deleting the row in the dataset and re-binding. I can give more information but i'm not sure what you need.
Hi,
I don't understand... why are you calling RefreshSort or RefreshSortPosition? There's no reason why deleting a row should change the sorting or grouping.