在 TcxGrid 中创建执行时间列,就像 delphi 中的 tDbGrid 一样

发布于 2024-08-26 20:03:26 字数 86 浏览 15 评论 0原文

我使用 TcxGrid 但无法在执行时创建字段 因为我有一个数据透视查询并且列是可变的

我可以像 tDbGrid 一样填充 cxGrid 吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦境 2024-09-02 20:03:26

我这样解决了问题

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

I solved the problem like this

grdCevapDBTableView2.BeginUpdate;
grdCevapDBTableView2.ClearItems;
fillGridView(grdCevapDBTableView2,command);
grdCevapDBTableView2.DataController.CreateAllItems;
grdCevapDBTableView2.EndUpdate;
贪了杯 2024-09-02 20:03:26

我喜欢使用 TcxGrid.DataController.CreateAllItems 方法来创建数据源中存在的所有列。它采用一个布尔参数,您可以使用该参数决定是添加所有列还是仅添加缺少的列。

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.

影子的影子 2024-09-02 20:03:26

尝试这样的事情:

function TForm1.AddIntegerColumn(const ACaption, AName: string): TcxGridColumn;
begin
  Result := TableView.CreateColumn;
  Result.DataBinding.ValueTypeClass := TcxIntegerValueType;
  Result.Caption := ACaption;
  Result.Name := AName;
end;

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文