Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Grid and DatabaseAdapter

 Post Reply Post Reply
Author
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Topic: Grid and DatabaseAdapter
    Posted: 15 Oct 2019 at 7:04pm
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!
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3365
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2019 at 10:27am
Hi,

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.
Back to Top
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2019 at 6:55pm
Ok, this a method of the Adapter, not the grid.

How do I reconnect the Adapter?
Back to Top
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2019 at 8:55pm
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?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3365
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2019 at 8:20am
You can toggle the Active property.
Back to Top
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2019 at 8:29am
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?

Thank you!
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3365
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2019 at 8:35am
Hi,

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.
Back to Top
Maierhofer Bernd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 Oct 2015
Posts: 108
Post Options Post Options   Quote Maierhofer Bernd Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2019 at 8:39am
I see - now things are clear, thank you.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down