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
|