문제

I use TcxGrid But I cant create fields on execution time because I have a pivot query and columns are variable

Can I fill cxGrid like tDbGrid?

도움이 되었습니까?

해결책 2

I solved the problem like this

grdCevapDBTableView2.BeginUpdate;
grdCevapDBTableView2.ClearItems;
fillGridView(grdCevapDBTableView2,command);
grdCevapDBTableView2.DataController.CreateAllItems;
grdCevapDBTableView2.EndUpdate;

다른 팁

I like to use the TcxGrid.DataController.CreateAllItems method which creates all columns that exists in the datasource. It takes a boolean parameter with which you can decide wether to add all columns or only those missing.

Try something like this:

function TForm1.AddIntegerColumn(const ACaption, AName: string): TcxGridColumn;
begin
  Result := TableView.CreateColumn;
  Result.DataBinding.ValueTypeClass := TcxIntegerValueType;
  Result.Caption := ACaption;
  Result.Name := AName;
end;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top