You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Material UI Data Grid隐藏id列后,如何移除过滤器中的id选项

解决Material UI Data Grid隐藏列仍出现在过滤器中的问题

要让隐藏的id字段同时从过滤器选项中消失,只需在该列的定义里添加filterable: false属性即可——默认情况下所有列都是可过滤的,hide: true仅控制列的显示,不会影响过滤器的选项列表。

修改后的列配置代码如下:

const userColumns = [
  { field: "id", hide: true, filterable: false }, // 添加filterable: false
  {
    field: "name",
    headerName: "Name",
    flex: 1
  },
  { field: "email", headerName: "Email", flex: 1 },
  { field: "group", headerName: "Group", flex: 1 },
  { field: "supplier", headerName: "Supplier", flex: 1 }
];

这样设置后,id字段既不会在表格中显示,也不会出现在过滤器的可选字段列表里。

内容的提问来源于stack exchange,提问作者Joseph

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 11:48:36