如何从TcxGrid列过滤器中删除“自定义”过滤器?

时间:2015-12-22 07:49:58

标签: delphi filter devexpress tcxgrid

我有一个包含一些列和数据的TcxGrid。列允许过滤:

enter image description here

我想从下拉过滤器中删除“自定义”选项,但保留所有其余选项([全部]和自动建议)。我该怎么做?

1 个答案:

答案 0 :(得分:3)

可以在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;