【问题标题】:Hiding devexpress editors in filterrow在 filterrow 中隐藏 devexpress 编辑器
【发布时间】:2016-04-20 15:14:14
【问题描述】:

我有一个 TcxGrid,我在其中定义了一个过滤器,但由于我在网格中有一些复选框和按钮,它们也显示在过滤器行中。 我已经尝试了几乎所有方法来摆脱它们,但没有任何效果。 DevExpress 的答案也无济于事(如果我有时间,我实际上会更改为其他一些组件)

有没有人处理过这个问题并且可能有我可以使用的解决方案?

【问题讨论】:

  • 一旦你找到 DevExpress 的替代品,请告诉我 :)
  • "因为我有一些复选框和按钮" 想必您不是指数据行中的复选框和按钮,那么您如何添加它们? q 中的一些代码或屏幕截图会有所帮助。
  • 有替代品,但不那么容易使用 :-) 使用几个小时转换的想法让我汗流浃背
  • 复选框和按钮位于每个数据行中,通过添加列并将编辑器设置为 ButtonEdit 或 CheckBox 来设置标准
  • 在网格底部过滤行?你是怎么做到的?从未见过这样做,也找不到任何属性来设置它。查找面板我可以,但这不是我使用的那个

标签: delphi devexpress tcxgrid


【解决方案1】:

下面的项目显示了数据行下方的过滤器框(我以为你在谈论),并且没有任何 为网格列定义的控件。我希望这就是你所追求的。

顺便说一句,我使用的是今年早些时候推出的最新版本的 TcxGrid,v.15 iirc。

更新我承认我对你的问题感到困惑,因为在filter row 中显示控件的原因肯定是允许用户指定过滤器的值,所以如果你是要隐藏它们,用户不能使用filter row。如果您想要比我更好的答案,我认为您需要更新您的 q 以准确解释您要做什么。

我不确定您是否知道,但过滤器 Box 有一个 Position 属性,可以设置该属性,以便该框显示在数据行上方。

代码

  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

【讨论】:

  • 在此示例中您没有使用过滤器行 - 您使用的是过滤器框,这完全不同。
  • 好的,我明白你在说什么,但现在我很困惑:如果你不希望它显示它提供的控件来让你指定过滤值?顺便说一句,我不确定您是否知道,但 Filter box 有一个 Position 属性,可用于将其显示在数据行上方。
  • 我只希望我选择的列是可搜索的,这样用户就可以输入要搜索的内容。在这种情况下,过滤器框只会让我的大多数用户感到困惑。不过我在另一个应用程序中使用它。
  • 我认为 Filter Row 或 Filter Box 并不真正支持这一点。如果您允许用户选择数据行,然后有一个对话框从其列值构造过滤器表达式,这可能是最简单的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-07
  • 2012-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多