Kromster
Kromster

Reputation: 7427

How to remove "Custom" filter from TcxGrid column filters?

I have a TcxGrid with some columns and data. Columns allow filtering:

enter image description here

I want to remove the "Custom" option from the drop-down filter, but leave all the rest ([All] and auto-suggested). How do I do this?

Upvotes: 0

Views: 3264

Answers (1)

Jens Borrisholt
Jens Borrisholt

Reputation: 6402

It's possible to test for what you are looking for in DataController.Filter.OnGetValueList:

procedure TForm1.cxGridTableView1DataControllerFilterGetValueList(
  Sender: TcxFilterCriteria; AItemIndex: Integer; AValueList: TcxDataFilterValueList);
var
  i: Integer;
begin
  for i := 0 to AValueList.Count - 1 do
    if AValueList[i].Kind = TcxFilterValueItemKind.fviCustom then
    begin
      AValueList.Delete(i);
      break;
    end;

    //  AValueList[i].Kind is one of
    //  fviAll, fviCustom, fviBlanks, fviNonBlanks, fviUser, fviValue, fviMRU, fviMRUSeparator, fviSpecial, fviUserEx
end;

Upvotes: 3

Related Questions