【问题标题】:React DataGrid columns show hideReact DataGrid 列显示隐藏
【发布时间】:2020-03-15 09:28:55
【问题描述】:

我正在为我的 react 应用程序使用数据网格 (https://js.devexpress.com/)。我能够定义列,使用列选择器添加-删除它们。但我需要使用 setState 添加-删除(或显示/隐藏)列。是否可以? 一些伪代码:

`constructor -> 
this.columns =
[
      {
        name: "name",
        title: "Name",
        }, ....
]
<DataGrid
                domain={"manageLocations"}
                columns={this.columns}
                context={context}
                // rows={test_locations}
                dataPath={"locations"}
                getRowId={this.getRowId}
                pagingEnabled={this.pagingEnabled}
                pagingRemote={this.pagingRemote} ......

`

问题是,当我尝试将新状态传递给列时,Grid 没有更新

【问题讨论】:

  • 关于你所取得的成就的任何代码?

标签: reactjs


【解决方案1】:

找到解决方案。 addColumnsToStore = true;如果要动态添加/删除列,则必须为 false。

【讨论】:

    猜你喜欢
    • 2015-08-17
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    • 2019-05-09
    • 1970-01-01
    • 2020-10-26
    • 2020-12-31
    • 1970-01-01
    相关资源
    最近更新 更多