The following example demonstrates how to set filter criteria for the following string:
(CustNo < 1000) AND ((Name LIKE ‘A%’) OR (Name LIKE ‘Z%’)).
The colCustNo and colName objects are of the TcxGridDBColumn class. They identify the desired columns in a View.
To prevent the filter criteria from being updated every time a filter condition is added, operations are enclosed within the TcxFilterCriteria.BeginUpdate and TcxFilterCriteria.EndUpdate methods.
[Delphi]Open in popup windowvar AItemList: TcxFilterCriteriaItemList; ... <DataController>.Filter.BeginUpdate; try <DataController>.Filter.Root.Clear; <DataController>.Filter.Root.AddItem(colCustNo, foLess, 1000, '1000'); AItemList := <DataController>.Filter.Root.AddItemList(fboOr); AItemList.AddItem(colName, foLike, 'A%', 'A%'); AItemList.AddItem(colName, foLike, 'Z%', 'Z%'); finally <DataController>.Filter.EndUpdate; <DataController>.Filter.Active := true; end;
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου