Hi,
I've got a Grid bound to a BindingSource, which itself is bound to a DataTable (there's also a filter on the BindingSource). There's a Outlook-style Grouping against one of the columns on the Grid - let's call it Status. In addition, that column is using a ValueList to resolve an id field to string literals. It all works great.
However, if I programmatically update the data on the column by which I'm grouping by (Status), the Grid does not move the edited row into the correct group - it just stays where it was. I have confirmed that the data is correctly getting updated, and if I remove the GroupBy in the Grid, so that the column shows up in the rows as normal, I then see the cell changing value correctly - it's just the Grouping that's not working correctly.
I've tried refreshing the BindingSource and also the Grid (using Rows.Refresh) but it made no difference.
Any ideas?
Thanks
Isaac
I think a better way to do this would be to add the row to the grid's DataSource, rather than through the grid.
Oh, and by .AddRow() I mean .AddNew()... my mistake.
I have a different but related question. Didn't seem worth starting a new thread.
My issue is that I'd like to add a new row to a grid that uses outlook grouping. However, I get a "Can't add a row to group-by rows collection" error when calling Me.UltraGrid.DisplayLayout.Bands(0).AddRow().
To get around it, I'm turning ViewStyleBand to Vertical, adding the row, then switching it back to OutlookGroupBy. The problem with this is that the user gets disoriented. If they had specific groups expanded, that layout is lost when switching the ViewStyleBand.
So my question is, can I programatically add rows to a grid that uses outlook grouping *without* losing the current layout?
Thanks, that worked a treat.
Hi Isaac,
The grid does not move the row automatically - this is intentional. The idea is that you don't want the user to edit a cell and have the row move to a new location, because it would be confusing to the user.
To re-sort the row into it's new position, you can call RefreshSortPosition on the row. Or you can call SortedColumns.Refresh on the band to refresh the sorting of the entire band.