如何在 cxGrid 未绑定模式下隐藏一行?
已经几个小时了,我无法弄清楚。我用谷歌搜索并失败了。
我刚刚创建了一个带有网格的示例应用程序,并按照其推荐中的建议unbound mode
使用了它,它工作正常。OnFilterRecord
DevExpress
下面你可以看到我的测试代码:
type
TForm1 = class(TForm)
testLevel: TcxGridLevel;
testGrid: TcxGrid;
testView: TcxGridTableView;
testViewColumn1: TcxGridColumn;
testViewColumn2: TcxGridColumn;
procedure FormCreate(Sender: TObject);
procedure tviewDataControllerFilterRecord(
ADataController: TcxCustomDataController; ARecordIndex: Integer;
var Accept: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
testView.DataController.RecordCount := testView.DataController.RecordCount + 1;
testView.DataController.Values[testView.DataController.RecordCount - 1,0] := 'foo';
testView.DataController.Values[testView.DataController.RecordCount - 1,1] := 'bar';
testView.DataController.RecordCount := testView.DataController.RecordCount + 1;
testView.DataController.Values[testView.DataController.RecordCount - 1,0] := 'foo2';
testView.DataController.Values[testView.DataController.RecordCount - 1,1] := 'bar2';
end;
procedure TForm1.tviewDataControllerFilterRecord(
ADataController: TcxCustomDataController; ARecordIndex: Integer;
var Accept: Boolean);
begin
Accept := (testView.DataController.Values[ARecordIndex,0] <> 'foo');
end;
结果: