不要在Agcolumnstoolpanel中显示一些列

发布于 2025-02-02 20:47:09 字数 413 浏览 3 评论 0原文

如何防止agcolumnstoolpanel显示特定的列?

例如,我想不显示foobar的条目,但仅针对x,这意味着不可能更改foobar通过agcolumnstoolpanel列。

我正在使用Vue.js的Ag网格。

How could I prevent the agColumnsToolPanel from showing specific columns?

E.g. I would like to not show entries for the foo and bar, but only for the x, meaning that it would be impossible to change the foo, bar columns visibility through the agColumnsToolPanel.

enter image description here

I am using the Ag Grid with Vue.js.

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

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

发布评论

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

评论(2

叹梦 2025-02-09 20:47:09

您必须更新工具面板中的列。

相关代码如下。获取对列工具面板的引用,然后将列设置为FOO和bar的列定义。

    setCustomCols() {
      var columnToolPanel = this.gridApi.getToolPanelInstance('columns');
      columnToolPanel.setColumnLayout([{field: 'foo'}]}, {field: 'bar'});
    },

This example shows you have to update the columns in the tool panel.

Relevant code is as follows. Get a reference to the column tool panel and then set the columns to be just your column definitions for foo and bar.

    setCustomCols() {
      var columnToolPanel = this.gridApi.getToolPanelInstance('columns');
      columnToolPanel.setColumnLayout([{field: 'foo'}]}, {field: 'bar'});
    },

瀟灑尐姊 2025-02-09 20:47:09

我假设您只想显示X而不是foobar。您可以在ColumnToolPanel.setColumnlayout中指定列列表,并且只有这些列会显示在侧面面板中。

这是一个简单的 demo

I am assuming you want to show only x and not foo and bar. you can specify the column list in columnToolPanel.setColumnLayout and only those column will show up in the side panel.

here is a simple demo

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