1. uses cxFilter;
cxgrid过滤条件清除:cxgrdbtblvwGrid1DBTableView2.DataController.Filter.AutoDataSetFilter:=True;
                                     cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Clear;
cxgrid过滤条件添加:cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Root.Clear;

  1. cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Root.AddItem(cxgrdbtblvwGrid1DBTableView2.GetColumnByFieldName('合同号'),folike,'%'+hth+'%','%'+hth+'%');
  2. cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Active:=True ;
 
CXGRID程序控制过滤方法:

  1. DBTable.DataController.Filter.Root.Clear;
  2. // DBTable.DataController.Filter.Root.BoolOperatorKind过滤关系【有四个值】
  3. DBTable.DataController.Filter.Root.BoolOperatorKind:= fboOR;//或者
  4. DBTable.DataController.Filter.Root.BoolOperatorKind:= fboAND;//并且
  5. DBTable.DataController.Filter.Root.BoolOperatorKind:= fboNOTOR;//非或者
  6. DBTable.DataController.Filter.Root.BoolOperatorKind:= fboNOTAND;//非并且
  7. //DBTable.DataController.Filter.Root.AddItem(AItemlink:Tobject;Aoperatorkind:Tcxfilteroperator;Const Avalue:variant;const Adisplayvalue:STRING);

相应说明:
AItemlink=列
Aoperatorkind=条件
foequal        等于
fonotequals        不等于
foless        小于
folessequal        小于等于
fogreater        大于
fogreaterequal        大于等于
oflike        相似
ofnotlike        不相似
    ofblank        为空
    ofnotblank        不为空
Avalue=条件值
Adisplayvalue=显示值
DBTable.DataController.Filter.Active:=TRUE;

//由上面可得出一个过程:
PROCEDURE DATA_ADDITEM(CXDATA:TcxGridDBDataController;Index,IfInt:integer;VarStr,PlaStr:String);
Var IfStr:TcxFilterOperatorKind;
Begin
  Case IfInt Of
      0: IfStr:= foEQUALS;
      2: IfStr:=foNOTEQUALS;
      3: IfStr:=foLESS;
      4: IfStr:=foLESSEQUAL;
5: IfStr:=foGREATER;
      6: IfStr:=foGREATEREQUAL;
      7: IfStr:=ofLIKE;
      8: IfStr:=ofNOTLIKE;
      9: IfStr:=ofBLANK;
      10:IfStr:=ofNOTBLANK;
  End;
CXDATA.ROOT.AddItem(CXDATA.Columns[Index],IfStr,VarStr,PlaStr)
End;

 
  1. uses cxFilter;
  2. with cxGridDBBandedTableView.DataController.Filter do
  3. begin
  4. Root.Clear;
  5. Root.AddItem(cxGridDBBandedTableView.GetColumnByFieldName('操作员姓名'), foLike, '%' + Trim(cxTextEdit.Text) + '%', '%' + Trim(cxTextEdit.Text) + '%');
  6. Active := True;
  7. end;
 

设置过滤的案例:

  1. <AGridView>.DataController.Filter.AddItem(nil, <AOrderDateColumn>, foEqual, '5/25/1988', '5/25/1988');
  2. To enable/disable filtering via code set the GridView's DataController.Filter.Active property to True.
  3. [Delphi]Open in popup window
  4. <AGridView>.DataController.Filter.Active := False;

cxgrid过滤使用心得的更多相关文章

  1. cxGrid控件过滤筛选后如何获更新筛选后的数据集

    cxGrid控件过滤筛选后如何获更新筛选后的数据集 (2015-06-19 12:12:08) 转载▼ 标签: delphi cxgrid筛选数据集 cxgrid过滤 分类: Delphi cxGri ...

  2. Delphi CxGrid 汇总(4)

    1.     CxGrid汇总功能 ① OptionsView-Footer设置为True,显示页脚   ② CxGrid的Summary选项卡定义要汇总的列和字段名及汇总方式,Footer选项卡定义 ...

  3. cxGrid使用汇总4

    1.     CxGrid汇总功能 ① OptionsView-Footer设置为True,显示页脚   ② CxGrid的Summary选项卡定义要汇总的列和字段名及汇总方式,Footer选项卡定义 ...

  4. 关于 cxGrid 的过滤问题

    http://bbs.csdn.net/topics/390536919 关于 cxGrid 的过滤问题 [问题点数:20分,结帖人zhengyc653]             不显示删除回复   ...

  5. cxGrid实现取消过滤和排序后定位到首行(单选和多选)

    cxGrid实现取消过滤和排序后定位到首行(单选和多选) 原创 2013年10月06日 18:42:24 2107 DataContoller中的函数FocusedRecordIndex没有反应,Fo ...

  6. 每日学习心得:UEditor样式被过滤无法显示问题

    前言: 上周开发中有用到开源的富文本编辑器UEditor,在使用的过程中遇到了样式被过滤无法显示问题,经过一番折腾终解决,此外,还有一些关于获取前台界面元素的一些总结. 1. UEditor样式被过滤 ...

  7. 关于小改CF协同过滤至MapReducer上的一些心得

    至上次重写ID3 MR版之后,手贱继续尝试CF.之前耳闻CF这两年内非常火,论内某大神也给了单机版(90%代码来自于其).所以想试试能否改到MR上.整体来说,CF本身的机制以相似性为核心,与迭代调用几 ...

  8. cxGrid控件过滤排序和TClientDataSet同步

    https://www.cnblogs.com/false/archive/2013/02/24/2924240.html procedure TReport10Form.cxGridViewData ...

  9. 如何访问cxGrid控件过滤后的数据集

    var I: Integer; begin Memo1.Lines.Clear; with cxGrid1DBTableView1.DataController do for I := 0 to Fi ...

随机推荐

  1. C#在Winform程序中显示QQ在线状态

    首先,引入必要的命名空间 using System.Windows.Forms;  using System.Net; 其次,在Form中拖入一个PictureBox控件,并设置其SizeMode为A ...

  2. EXISTS 和 IN 的区别

    exists子句的用法 select * from 表1 where exists (select * from 表2 where 表1.列名=表2.列名); exists子句返回的结果并不是从数据库 ...

  3. MySQL 检索数据及提高检索速度的方法

    检索数据 mysql> SELECT [DISTINCT] 表名.列名,表名.列名,表名.列名 -- 使用通配符*表示所有列 DISTINCT表示返回不同的值 -> FROM 数据库名.表 ...

  4. Spring IOC(三)单例 bean 的注册管理

    Spring IOC(三)单例 bean 的注册管理 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 在 Spring 中 ...

  5. java集合示例 小心重载的陷阱

    package com.hra.riskprice; import com.hra.riskprice.SysEnum.Factor_Type; import org.springframework. ...

  6. IDEA 文件列表隐藏某后缀文件

    preferences -> Editor -> File Types -> ignore files and folders   添加后缀类型如:   *.meta

  7. Epson Pos Printer for .net

    注:因发现各网站爬虫随意收集文章,故做此声明:版权归原作者(Leaf.Duan)所有,转载还请著名出处,谢谢 设备信息 Epson TM-T88IV Thermal Printer,爱普生 TM-T8 ...

  8. UVa 10163 Storage Keepers (二分 + DP)

    题意:有n个仓库,m个管理员,每个管理员有一个能力值P,每个仓库只能由一个管理员看管,但是每个管理员可以看管k个仓库(但是这个仓库分配到的安全值只有p/k,k=0,1,...),雇用的管理员的工资即为 ...

  9. 以太网MAC地址规范

    原文地址:http://blog.csdn.net/skyflying2012/article/details/40322563 之前一段时间在做网卡驱动的工作,现在产品量产,利用ifconfig e ...

  10. 通用的进程监控脚本process_monitor.sh使用方法

    不用做任何修改,即可用process_monitor.sh监控各种进程. 源码下载:https://github.com/eyjian/libmooon/blob/master/shell/proce ...