TcxFilterCriteria.BeginUpdate Method
Postpones all filter criteria calculations and corresponding UI redraw operations until an EndUpdate procedure call.
Declaration
procedure BeginUpdate;
Remarks
Every time you change filter criteria, the data controller notifies the control about the corresponding data change. Enclose multiple filter criteria changes between BeginUpdate
and EndUpdate procedure calls to avoid UI flickering due to excessive redraw operations and improve performance.
BeginUpdate/EndUpdate Calls and Batch Changes
A BeginUpdate
procedure call disables notifications and postpones all filter criteria changes until an EndUpdate call. A subsequent EndUpdate call does the following:
- Re-enables change notifications and corresponding redraw operations
- Applies all changes made after a
BeginUpdate
call - Sends corresponding notifications in a batch
- Redraws the parent control
Note
Ensure that every BeginUpdate
procedure call is followed by an EndUpdate or CancelUpdate call, even if an exception occurs.
Code Example
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;