[英]How to disable the menu button option in DataGrid MUI?
I want to disable the button that pops all the options like: Sort, Filter, Hide, Etc.我想禁用弹出所有选项的按钮,如:排序、过滤、隐藏等。
I know you can remove the sorting option in the columns with sortable: false
and if I want to remove everything else then I can simply use Both of this disableColumnFilter
to remove the filter and disableColumnSelector
to remove pretty much everything else However even if I remove all the options the button is still there and I want to remove it.我知道您可以使用
sortable: false
删除列中的排序选项,如果我想删除其他所有内容,那么我可以简单地使用这两个disableColumnFilter
来删除过滤器并使用disableColumnSelector
来删除几乎所有其他内容但是即使我删除所有按钮的选项仍然存在,我想将其删除。
I should have done more research before asking but I found the answer after checking for something else.我应该在问之前做更多的研究,但我在检查其他东西后找到了答案。
So you have 3 'modifiers'所以你有 3 个“修饰符”
disableColumnMenu
disableColumnFilter
disableColumnSelector
disableColumnMenu
will completely remove the button with the options disableColumnFilter
will just remove the filter option disableColumnSelector
will remove the hide/show columns disableColumnMenu
将完全删除带有选项disableColumnFilter
的按钮将只删除过滤器选项disableColumnSelector
将删除隐藏/显示列
you can check the sort true/false while creating the columns with a simple sortable = true/false
您可以在使用简单的
sortable = true/false
创建列时检查sortable = true/false
Ej: Ej:
const columns = [
{ field: 'name', headerName: 'Name', width: 450, sortable: true/false}
]
And this is how it looks with disableColumnMenu
it doesn't show the button anymore at all这就是
disableColumnMenu
样子,它根本不再显示按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.