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++连接MySQL(Windows)

    一般来说,VS下采用微软自身的SQL Server是比较常见的做法,但SQL Server只适合学习,不适合真正应用.在此,我们选择MySQL作为后台数据库.C++语言本身并没有提供访问数据库的东西, ...

  2. LIbreOJ #6011. 「网络流 24 题」运输问题 最小费用最大流

    #6011. 「网络流 24 题」运输问题 内存限制:256 MiB时间限制:1000 ms标准输入输出 题目类型:传统评测方式:文本比较 上传者: 匿名 提交提交记录统计讨论测试数据   题目描述 ...

  3. KeyPress键盘按键ASCII值对应表

    vbKeyLButton 1 鼠标左键  vbKeyRButton 2 鼠标右键  vbKeyCancel 3 CANCEL 键  vbKeyMButton 4 鼠标中键  vbKeyBack 8 B ...

  4. php mysql 丢失更新

    php mysql 丢失更新问题,搜索整个互联网,很少有讲到,也许和php程序员出身一般都是非科班出身有关系吧. 另外php程序一般都是简单数据,很少有并发一致性问题,所以大家都没有谁专门提出这个问题 ...

  5. MySQL自带的4个数据库

    安装完 MySQL 后会发现有四个自带的数据库: information_schema -- 该数据库保存了 MySQL 服务器所有数据库的信息.比如数据库的名称.数据库中的表名称.访问权限.数据库中 ...

  6. How to reconfigure installed dpkg package (tzdata, locales)

    1 List the installed dpkg package $ sudo dpkg --list 2 Reconfigure the package $ sudo dpkg-reconfigu ...

  7. Pairs of Songs With Total Durations Divisible by 60 LT1010

    In a list of songs, the i-th song has a duration of time[i] seconds. Return the number of pairs of s ...

  8. 使用Apache CXF和Spring集成创建Web Service(zz)

    使用Apache CXF和Spring集成创建Web Service 您的评价:       还行  收藏该经验       1.创建HelloWorld 接口类 查看源码 打印? 1 package ...

  9. mybatis不报错,但是查询结果为0

    [转载]https://blog.csdn.net/shenzhenNBA/article/details/46673327 在用MyBatis操作数据库的时候相信很多人都用到,当在判断null, 大 ...

  10. linux_配置三台虚拟机免密登录

    在node01上面直接生成公钥和私钥 ssh-keygen --> 四下回车 ll -a 进行查看,发现出现.ssh文件即已经生成 将此node01的公钥拷贝到第二台机器上 ssh-copy-i ...