如何在cxGrid未绑定模式下隐藏行?
已经好几个小时了,我无法理解。我用Google搜索并失败了。
答案 0 :(得分:1)
我刚刚在unbound mode
创建了一个带有网格的示例应用,并使用了OnFilterRecord
在其recommendation中建议的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;
结果: