TcxFilterCriteriaItemList.AddItem(TObject,TcxFilterOperatorKind,Variant,string) Method
In This Article
Adds a simple criterion to the filter criteria list.
#Declaration
Delphi
function AddItem(AItemLink: TObject; AOperatorKind: TcxFilterOperatorKind; const AValue: Variant; const ADisplayValue: string): TcxFilterCriteriaItem; overload;
#Parameters
Name | Type | Description |
---|---|---|
AItem |
TObject | The target data item. |
AOperator |
Tcx |
The target filter criterion operator. |
AValue | Variant | The comparison (reference) value. |
ADisplay |
string | The created filter condition’s display text. |
#Returns
Type | Description |
---|---|
Tcx |
The created filter criterion. |
#Remarks
Call the AddItem
function to create a new simple filter criterion. The AddItemList function allows you to add an aggregate condition.
#Code Example: Apply Custom Filter Criteria to Grid Columns
The code example in this section applies the following filter criteria to CustomerCount and Name data grid columns:
(CustomerCount < 1000) AND ((Name LIKE 'A%') OR (Name LIKE 'Z%'))
var
ADataController: TcxGridDBDataController;
AItemList: TcxFilterCriteriaItemList;
begin
ADataController := cxDBTableView1.DataController;
ADataController.Filter.BeginUpdate; // Initiates the following batch data controller change
try
ADataController.Filter.Root.Clear;
ADataController.Filter.Root.AddItem(cxDBTableView1CustomerCount, foLess, 1000, '1000');
AItemList := ADataController.Filter.Root.AddItemList(fboOr);
AItemList.AddItem(cxDBTableView1Name, foLike, 'A%', 'A%');
AItemList.AddItem(cxDBTableView1Name, foLike, 'Z%', 'Z%');
ADataController.Filter.Active = True;
finally
ADataController.Filter.EndUpdate; // Calls EndUpdate regardless of the batch operation's success
end;
end;
See Also