Filters
Once the data is loaded, it can be filtered on the client side without sending any requests to the server.
On the main form, add a TEdit
and name it editFilter, and a TButton
called btnFilter.
Implement an onClick
handler to call the FilterTask
method on the DataModule.
procedure TClientForm.btnFilterClick(Sender: TObject);
begin
ClientDataModule.FilterTask(editFilter.Text);
end;
In the DataModule, implement the FilterTask
method.
procedure TClientDataModule.FilterTask(aFilter: String);
begin
tbl_Tasks.Filter := aFilter;
tbl_Tasks.Filtered := tbl_Tasks.Filter <> '';
end;
Now the records in the Tasks table can be filtered locally, without any data requests being sent to the server.