Posted 29 October 2024, 6:44 am EST
I’ve a winforms flexgrid with the datasource assigned to a datatable fetched from database and programmatically sorted.
DataTable fetchedData = DatabaseCall();
flexGrid.DataSource = fetchedData;
flexGrid.GroupDescriptions = new List<GroupDescription>
{
new GroupDescription("TYPE", ListSortDirection.Ascending, false),
new GroupDescription("DESCRIPTION", ListSortDirection.Ascending, false),
new GroupDescription("KEY_TARIFF_1", ListSortDirection.Ascending, false),
new GroupDescription("ORDER", ListSortDirection.Ascending, false)
};
The sorting needs to be set to multi column as the user is able to further change the sorting.
The issue comes when I add a new row or update a cell. After the cell is edited the grid resorts itself and the current selection is lost. How can I disable the sorting only for the edit action and re-enable it afterwards?