Skip to main content

TcxCustomGridTableView.OnFilterDialogShow Event

Enables you to prevent filter dialogs from being displayed or substitute them with your own filter dialog(s).

Declaration

property OnFilterDialogShow: TcxGridFilterDialogShowEvent read; write;

Remarks

Views support two built-in filter dialogs: Custom Filter dialog and Filter Builder dialog. The OnFilterDialogShow event is raised each time any of these dialogs is about to be displayed. The View that invokes the dialog is passed as the Sender parameter. The AItem parameter identifies the item for which the dialog is displayed. Normally, the AItem parameter’s value is nil if the Filter Builder dialog is about to be displayed. This parameter’s value is not nil if the Custom Filter dialog is being invoked. In this case, the parameter returns the item where the end-user invoked the filter dropdown and chose the Custom item.

Note

If more than two filter conditions have been applied to a column and the end-user clicks the Custom item within the column’s filter dropdown, the Filter Builder dialog is invoked instead of the Custom Filter dialog. In such cases, the AItem parameter’s value is not nil. Thus, you should use the IsFilterControlDialogNeeded function to determine which dialog will be displayed. Pass the data controller’s Filter property value to this function. You should handle the OnFilterCustomization event to perform the same tasks.

The ADone parameter specifies whether the dialog should be displayed. Set this parameter to False if you don’t need to show the dialog. This can be used, for instance, when you want to substitute the built-in dialogs with your own dialog. You can also use this, for instance, if you need to display the Filter Builder dialog even in cases when the Custom Filter dialog should be invoked by default. The sample code below shows how this can be implemented.

procedure TForm2.FilterDialogShow(Sender: TcxCustomGridTableView;
  AItem: TcxCustomGridTableItem; var ADone: Boolean);
begin
  if AItem <> nil then
  begin
    Sender.Filtering.RunCustomizeDialog(nil);
    ADone := True;
  end;
end;

This sample code assumes that the procedure which handles the OnFilterDialogShow event is called ‘FilterDialogShow‘.

See Also