【问题标题】:Hide Column in Material UI Data Grid Filter隐藏材质 UI 数据网格过滤器中的列
【发布时间】:2022-10-13 10:10:07
【问题描述】:

我已成功将id 隐藏在列中。但是我如何也将它隐藏在过滤器中?

<StyledDataGrid
  getRowId={(r) => r.newId}
  columns={columns}
  rows={rows}
  disableSelectionOnClick
  checkboxSelection
/>;

const columns = [
  { field: "id", hide: true, filterable: false },
  {
    field: "product",
    headerName: "Product Name",
  },
  { field: "price", headerName: "Price" },
  {
    field: "expiry",
    headerName: "Expiry date",
  },
];

【问题讨论】:

    标签: reactjs material-ui


    【解决方案1】:

    当您向&lt;StyledDataGrid /&gt; 提供列时,您可以应用过滤器。

    colums={ columns.filter((col) => !col.hide) }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-26
      • 2021-04-12
      • 1970-01-01
      • 2020-12-21
      • 2017-03-24
      • 1970-01-01
      相关资源
      最近更新 更多