EhLib.Com
https://forum.ehlib.com/en/

Ascending order and descending order in dbgridEh
https://forum.ehlib.com/en/viewtopic.php?f=5&t=1202
Page 1 of 1

Author:  ituneksa [ 22 Feb 2023, 18:19 ]
Post subject:  Ascending order and descending order in dbgridEh

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 937 times ]

Author:  ituneksa [ 23 Feb 2023, 18:33 ]
Post subject:  Re: Ascending order and descending order in dbgridEh

What i did in the DBGridEh1 :

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

but no work the sort.

Author:  EhLibSupport [ 25 Feb 2023, 03:38 ]
Post subject:  Re: Ascending order and descending order in dbgridEh

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.

Author:  ituneksa [ 25 Feb 2023, 14:18 ]
Post subject:  Re: Ascending order and descending order in dbgridEh

I added in the project EhLibFireDAC i got error (see pict)

Attachments:
sort.jpg
sort.jpg [ 18.46 KiB | Viewed 877 times ]

Author:  EhLibSupport [ 25 Feb 2023, 20:16 ]
Post subject:  Re: Ascending order and descending order in dbgridEh

Hello

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

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/