- uses cxFilter;
cxgrid过滤条件清除:cxgrdbtblvwGrid1DBTableView2.DataController.Filter.AutoDataSetFilter:=True;
cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Clear;
cxgrid过滤条件添加:cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Root.Clear;
cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Clear;
cxgrid过滤条件添加:cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Root.Clear;
- cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Root.AddItem(cxgrdbtblvwGrid1DBTableView2.GetColumnByFieldName(‘合同号‘),folike,‘%‘+hth+‘%‘,‘%‘+hth+‘%‘);
- cxgrdbtblvwGrid1DBTableView2.DataController.Filter.Active:=True ;
CXGRID程序控制过滤方法:
相应说明:
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;
- DBTable.DataController.Filter.Root.Clear;
- // DBTable.DataController.Filter.Root.BoolOperatorKind过滤关系【有四个值】
- DBTable.DataController.Filter.Root.BoolOperatorKind:= fboOR;//或者
- DBTable.DataController.Filter.Root.BoolOperatorKind:= fboAND;//并且
- DBTable.DataController.Filter.Root.BoolOperatorKind:= fboNOTOR;//非或者
- DBTable.DataController.Filter.Root.BoolOperatorKind:= fboNOTAND;//非并且
- //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;
- uses cxFilter;
- with cxGridDBBandedTableView.DataController.Filter do
- begin
- Root.Clear;
- Root.AddItem(cxGridDBBandedTableView.GetColumnByFieldName(‘操作员姓名‘), foLike, ‘%‘ + Trim(cxTextEdit.Text) + ‘%‘, ‘%‘ + Trim(cxTextEdit.Text) + ‘%‘);
- Active := True;
- end;
- <AGridView>.DataController.Filter.AddItem(nil, <AOrderDateColumn>, foEqual, ‘5/25/1988‘, ‘5/25/1988‘);
- To enable/disable filtering via code set the GridView‘s DataController.Filter.Active property to True.
- [Delphi]Open in popup window
- <AGridView>.DataController.Filter.Active := False;