小弟最近正在使用cxgrid,现想请教如下问题,cxgrid中的在单击列名后可以进行筛选,我想做一个button,通过click来实现指定条件的筛选,如何实现,还请各位多多指教。

解决方案 »

  1.   

    什么意思?button是在cxgrid中还是单独的?要是单独的,无非就是设置Table或者Query的filter属性而已,实际上cxGrid也是这么做的,没有什么特别的地方,你可以看看cxGrid的源代码,我是看过的
      

  2.   

    button是单独的,我用的不是cxgridDBTableView,我用的是cxgridTableView,没有table或query,所以不知道该怎么做。
      

  3.   

    我是说你的button是在cxgrid中么?如果不是,那就直接在button里边写filter就可以了
      

  4.   

    procedure TSendInfoForm.FiltercxGridTableView(FildName, FilterValue: String);
    begin
      with cxgridtvSendInfo, DataController.Filter do
      begin
        BeginUpdate;
        try
          Root.Clear;
          Root.AddItem(cxgridtvSendInfo.GetColumnByFieldName(FildName), foEqual, FilterValue, FilterValue);
          if not Active then
            Active:=true;
        finally
          EndUpdate;
        end;
      end;
    end;