When using the grid Bound to the Adapter, I can not get sorting to work.
Additionally setting Options.Filtering.DropDown:=True; only adds (All) and does not add the unique values from the column.
Is this ok or am I missing something?
Thank you for your support!
Grouping, filtering, sorting and all other grid operations that manipulate or use data are not supported while having an active database connection. To solve this, you need to use LoadAllDataAndDisconnect call on grid level and then afterwards apply sorting.
Ok, this a method of the Adapter, not the grid.
How do I reconnect the Adapter?
If I disconnect the Adapter, the grid no longer navigates the dataset.
I have a grid, additinally there are some TEdits bound to the dataset. So when I navigate in the grid, the controls are updated. When I diconnect the Adapter, I loose this.
How do I solvbe this?
You can toggle the Active property.
Sorry, but I do not understand. For what component should I toggle "Active"? And why does this solve my problem? Deactivating the adapter does no longer sync grid and dataset, so livebindings form dataset to controls won?t work.
Any working example for a grid/dataseet/controls combination with the grid filtering/sorting?
As already mentioned 2 posts above, grouping, sorting, filtering is not supported when having an active databinding, you can use the LoadAllDataAndDisconnect method to load all data in the grid, perform a filter operation, and after the filter operation is finished, clear the filter and set the Active property to true, to re-enable the databinding. You cannot edit and post data during grouping, filter and sorting operations.
Alternatively, filtering and sorting can be done using a query as well. The OnCanSortColumn, that is triggered before sorting, allows you to cancel the normal sorting, and apply sorting on the dataset instead. For filtering, the OnNeedFilterDropDownData event can be used to fill the filter with the values from the dataset and the OnFilterSelect is the event that is called when a filtering condition is selected. You can also cancel the normal filter operation and perform a filter operation on the query instead. This way, you can keep the databinding active, but it requires a bit of manual work. Grouping is not available using the alternative method.
I see - now things are clear, thank you.