OZ8HP
OZ8HP

Reputation: 1513

Hiding devexpress editors in filterrow

I have a TcxGrid where I have a filter defined on, but since I have some checkboxes and buttons in the grid, they are also shown in the filterrow. I have tried almost everything to get rid of them, but nothing works. The answers from DevExpress are not helpfull either (if I had the time I would actually change to some other components)

Is there anyone who has worked with this and might have a solution I could use?

enter image description here

Upvotes: 1

Views: 1173

Answers (1)

MartynA
MartynA

Reputation: 30715

The project below shows the filter box (which is what I thought you were talking about) below the data rows and without any of the controls defined for the grid columns. I hope this is the sort of thing you are after.

Btw, I did this with a recent version of TcxGrid dating from earlier this year, v.15 iirc.

update I confess I'm confused by your question because surely the reason the controls are displayed in the filter row is to allow the user to specify the values for the filter, so if you were to hide them, the user couldn't use the filter row. If you want a better answer than mine, I think you need to update your q to explain exactly what you're trying to do.

I'm not sure if you are aware but the Filter Box has a Position property that can be set so that the box displays above the data rows.

Code

  TForm1 = class(TForm)
    cxGrid1DBTableView1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    cxGrid1: TcxGrid;
    CDS1: TClientDataSet;
    CDS1Marked: TBooleanField;
    CDS1ID: TIntegerField;
    DS1: TDataSource;
    cxGrid1DBTableView1ID: TcxGridDBColumn;
    cxGrid1DBTableView1Marked: TcxGridDBColumn;
    CDS1Value: TIntegerField;
    cxGrid1DBTableView1Value: TcxGridDBColumn;
    procedure FormCreate(Sender: TObject);
  private
  protected
  public
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  CDS1.CreateDataSet;
  CDS1.InsertRecord([0, False, 99]);
  CDS1.InsertRecord([1, False, 88]);
  CDS1.InsertRecord([2, False, 77]);
  CDS1.InsertRecord([3, False, 66]);
  CDS1.First;
end;

end.

DFM

object Form1: TForm1
  Left = 267
  Top = 103
  Caption = 'MADefaultForm'
  ClientHeight = 360
  ClientWidth = 454
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  Position = poScreenCenter
  Scaled = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object cxGrid1: TcxGrid
    Left = 0
    Top = 0
    Width = 454
    Height = 360
    Align = alClient
    TabOrder = 0
    object cxGrid1DBTableView1: TcxGridDBTableView
      Navigator.Buttons.CustomButtons = <>
      FilterBox.Visible = fvAlways
      DataController.DataSource = DS1
      DataController.Filter.Active = True
      DataController.KeyFieldNames = 'ID'
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <>
      DataController.Summary.SummaryGroups = <>
      FilterRow.Visible = True
      object cxGrid1DBTableView1ID: TcxGridDBColumn
        DataBinding.FieldName = 'ID'
      end
      object cxGrid1DBTableView1Marked: TcxGridDBColumn
        DataBinding.FieldName = 'Marked'
        Width = 97
      end
      object cxGrid1DBTableView1Value: TcxGridDBColumn
        DataBinding.FieldName = 'Value'
        PropertiesClassName = 'TcxTextEditProperties'
      end
    end
    object cxGrid1Level1: TcxGridLevel
      GridView = cxGrid1DBTableView1
    end
  end
  object CDS1: TClientDataSet
    Aggregates = <>
    Params = <>
    Left = 48
    Top = 24
    object CDS1ID: TIntegerField
      FieldName = 'ID'
    end
    object CDS1Marked: TBooleanField
      FieldName = 'Marked'
    end
    object CDS1Value: TIntegerField
      FieldName = 'Value'
    end
  end
  object DS1: TDataSource
    DataSet = CDS1
    Left = 88
    Top = 24
  end
end

Upvotes: 2

Related Questions