Current filter:
                                You should refresh the page.
                                  • Description:
                                    Is is possible to apply a filter to the Grid at runtime via code?

                                    Answer:
                                    Below you will find a procedure, which allows you to add any filter condition to the Grid and a couple of example on how to use this procedure.

                                    [Delphi]
                                    uses dxGrFltr, dxFilter; type TDummyDBGrid = class(TCustomdxDBGrid); TDummyDBGridFilter = class(TdxDBGridFilter); procedure AddFilter(Column: TdxDBTreeListColumn; Value: Variant; DisplayValue: string; Operator: TdxOperatorType = otEqual; NotCriteria: Boolean = False); var Grid: TDummyDBGrid; Criteria: TdxCriteria; begin if Column = nil then Exit; Grid := TDummyDBGrid(Column.TreeList); Criteria := TDummyDBGridFilter(Grid.Filter).Criteria; with TdxDBGridCriteria(Criteria).AddItem(nil, Column, Operator, Value, DisplayValue, False) do if NotCriteria then IsNot := True; Grid.SetFilterMode; end; procedure TForm1.Button1Click(Sender: TObject); begin AddFilter(dxDBGrid1CustNo, 2000, '2000', otLess, True); AddFilter(dxDBGrid1Country, 'US', 'US', ); end;

                                0 Solutions

                                Creation Date Importance Sort by