Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 09:37

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 22 Feb 2023, 18:19 
Offline

Joined: 14 Jul 2022, 08:46
Posts: 22
Hi

How to do ascending order and descending (tran_no field) in dbgridEh using query dataset (see pic)

best regards


Attachments:
ehlib.jpg
ehlib.jpg [ 78.8 KiB | Viewed 734 times ]
Top
 Profile  
 
PostPosted: 23 Feb 2023, 18:33 
Offline

Joined: 14 Jul 2022, 08:46
Posts: 22
What i did in the DBGridEh1 :

DBGridEh1.OptionsEh.dghAutoSortMarking:=true;
DBGridEh1.OptionsEh.dghMultiSortMarking:=true;
DBGridEh1.ColumnDefValues.Title.TitleButton = True;

but no work the sort.


Top
 Profile  
 
PostPosted: 25 Feb 2023, 03:38 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
Hello

For automatically filtering/sorting data in dataset you need to add EhLibFireDAC unit to 'uses' clause of any unit of your project.
And may be also set Grid.SortLocal if you need to apply local sorting inside DataSet array of records.

TDBGridEh allows showing special sortmarking bitmaps (small triangles) in the right part of title cell. In order to automatically mark the title by sortmarking bitmaps you have to add dghAutoSortMarking to OptionsEh property. Add dghMultiSortMarking to OptionsEh in order to allow sortmarking in several columns simultaneously. Set Column.Title.TitleButton to true value for titles which will have possibility to change sortmarkers at run time. Or you can set ColumnDefValues.Title.TitleButton to allow setting sortmarking for all columns where Column.Title.TitleButton is not changed. At runtime, clicking on title will change sortmarking. Holding Ctrl key allows to mark several columns simultaneously. After user changes sormarking grid will call OnSortMarkingChanged event or will pass action to special object, if it is registered. Special object will use Grid.SortLocal property to determine how to sort data: locally or on the server. If you write OnSortMarkingChanged, you can use TDBGrid.SortMarkedColumns property to access the sortmarked columns and TColumnEh.Title.SortMarker property to get state of the sortmarker.

DBGridEh can not sort or filter data by itself. But it can pass action for sorting or filtering to the special object that will do it in DataSet. You can adjust grid for two types of sorting (local or server), using property SortLocal and two type of filtering (also, local and server), but real possibility to apply each type of operation depends on the type of DataSet. For instance, TBDEDataSet does not support sorting locally (inside DataSet). so you can not sort data locally when grid is linked to TQuery or TTable. Furthermore, EhLib has only special objects for standard types of DataSet (not for a third party DataSet's).

Read more information about sorting and filtering in the "EhLib Users Guide.doc" of the EhLib archive.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 25 Feb 2023, 14:18 
Offline

Joined: 14 Jul 2022, 08:46
Posts: 22
I added in the project EhLibFireDAC i got error (see pict)


Attachments:
sort.jpg
sort.jpg [ 18.46 KiB | Viewed 674 times ]
Top
 Profile  
 
PostPosted: 25 Feb 2023, 20:16 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
Hello

Copy EhLibFireDAC.pas from <EhLib Archive>\Common folder to your project folder.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 61 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group