Клубове Дир.бг
powered by diri.bg
търси в Клубове diri.bg Разширено търсене

Вход
Име
Парола

Клубове
Dir.bg
Взаимопомощ
Горещи теми
Компютри и Интернет
Контакти
Култура и изкуство
Мнения
Наука
Политика, Свят
Спорт
Техника
Градове
Религия и мистика
Фен клубове
Хоби, Развлечения
Общества
Я, архивите са живи
Клубове Дирене Регистрация Кой е тук Въпроси Списък Купувам / Продавам 05:22 05.07.25 
Клубове/ Компютри и Интернет / Delphi Пълен преглед*
Информация за клуба
Тема Ами то си пише в help-а, ама кой да чете... [re: AйeзCeдaй]
Автор andrew_nikoloff (bugbuster)
Публикувано27.09.07 12:02  



Using DBGridEh for sorting and filtering data in the DataSet.

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

Below you can see a table of special object and DataSet in witch these objects can sort or filter data.


Unit DataSet Local sorting Server sorting Local filtering Server filtering

EhLibBDE TQuery, TTable N Y Y Y
EhLibADO TADOQuery, Y Y Y Y

TADODataSet

EhLibCDS TClientDataSet Y Y Y Y
EhLibDBX TSQLQuery,

TSQLDataSet N Y N Y

EhLibIBX TIBQuery,

TIBDataSet N Y Y Y

When grid is adjusted for a local filtering the special object will build exprression and assign it to a property Filter of DataSet. So need also to set Filtered to True manually.

When grid is adjusted for a server filtering, the special object will build SQL:ORDER BY exprression and replace ORDER BY string in SQL or Command property of DataSet and reopen DataSet.

When grid is adjusted for a local sorting the special object will do a sorting using specific of the type of DataSet.

When grid is adjusted for a server sorting the special object will build expression for SQL 'WHERE' clause in SQL string of dataset. It will try to found string that begining from key string '/*Filter*/'(You can change this key string using global variable - SQLFilterMarker) in SQL expression a nd adds filter expression after this string in same line. So your SQL query have to have a line that begining from '/*Filter*/'. For instance:

' select *

from table1

where

/*Filter*/ 1=1 '

For automatically filtering/sorting data in dataset need to add one of the units EhLibXXX (EhLibADO, EhLibBDE, EhLibCDS ... dependenly of the dataset that grid is linked to) to 'uses' clause of any unit of your project. This units have code to register TDatasetFeaturesEh based classes (special o bject) for respective DataSet's. For other third party DataSet's you have to write and register your own special object or you have to wrtie OnApplyFilter or/and OnSortMarkingChanged event for every required grid. More other, you can write OnApplySorting and/or OnApplyFilter for the global varia ble DBGridEhDataService. These events has TNotifyEvent type where Sender is TCustomDBGridEh.

EhLib Software




Цялата тема
ТемаАвторПубликувано
* Конпонента... AйeзCeдaй   26.09.07 15:52
. * Re: Конпонента... Ивaнчo   27.09.07 09:46
. * Re: Конпонента... AйeзCeдaй   27.09.07 10:39
. * EhLib andrew_nikoloff   27.09.07 10:46
. * Re: EhLib AйeзCeдaй   27.09.07 11:41
. * Ами то си пише в help-а, ама кой да чете... andrew_nikoloff   27.09.07 12:02
. * Re: Ами то си пише в help-а, ама кой да чете... AйeзCeдaй   27.09.07 13:37
. * И на мен... andrew_nikoloff   27.09.07 15:38
. * Ако ми... AйeзCeдaй   27.09.07 16:35
. * Re: Ако ми... andrew_nikoloff   27.09.07 17:12
. * Re: Ако ми... AйeзCeдaй   28.09.07 09:49
. * Re: Ако ми... PhantomAS   28.09.07 10:37
. * Re: Конпонента... Mixy   27.09.07 10:10
Клуб :  


Clubs.dir.bg е форум за дискусии. Dir.bg не носи отговорност за съдържанието и достоверността на публикуваните в дискусиите материали.

Никаква част от съдържанието на тази страница не може да бъде репродуцирана, записвана или предавана под каквато и да е форма или по какъвто и да е повод без писменото съгласие на Dir.bg
За Забележки, коментари и предложения ползвайте формата за Обратна връзка | Мобилна версия | Потребителско споразумение
© 2006-2025 Dir.bg Всички права запазени.