1

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

OZ8HP
  • 1,443
  • 4
  • 31
  • 61
  • plz let me know once you find alternative of DevExpress :) – Zam Apr 20 '16 at 15:29
  • "since I have some checkboxes and buttons" Presumably, you don't mean checkboxes and buttons in the data rows, so how are you adding them? Some code or a screenshot in your q would help. – MartynA Apr 20 '16 at 15:40
  • There are alternatives but not as easy to use :-) and the thought of using several hours converting makes me sweat – OZ8HP Apr 20 '16 at 15:41
  • The checkboxes and buttons are in every datarow and are setup standard by adding a column and setting the editor to either ButtonEdit or CheckBox – OZ8HP Apr 20 '16 at 15:43
  • Um, have you tried configuring the grid so that the filter row is below the data rows? I just did that, and there are no checkboxes etc in the filter row. – MartynA Apr 20 '16 at 16:09
  • 1
    Filterrow at the bottom of grid? How did you do that? Have never seen that done and can't find any property to set that. The findpanel I can, but that is not the one I use – OZ8HP Apr 20 '16 at 16:44
  • Probably easiest if I post a minimalist project including DFM as an answer. Back in 15 mins ... – MartynA Apr 20 '16 at 16:56

1 Answers1

2

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
MartynA
  • 30,454
  • 4
  • 32
  • 73
  • You don't use the filter row in this sample - you use the filter box and that is something quite different. – OZ8HP Apr 21 '16 at 08:23
  • Ok I see what you're talking about, but now I'm confused: Why are you using a Filter Row if you don't want it to display the controls it provides to let you specify the filter values? Btw, I'm not sure if you are aware, but the Filter **box** has a Position property that can be used to display it above the data rows. – MartynA Apr 21 '16 at 13:07
  • I just want the columns I select to be searchable so user can type in what to search for. The filterbox just confuses most of my users in this case. I use it in another application though. – OZ8HP Apr 21 '16 at 14:40
  • I don't think the Filter Row or Filter Box really support that. Might be easiest if you allow the user to select a data row and then have a dialog to construct a filter expression from its column values. – MartynA Apr 21 '16 at 14:50