简体   繁体   English

想要更改 React Material-UI DataGrid filter menu popup 的 position

[英]want to change the position of React Material-UI DataGrid filter menu popup

i have implemented React Material-UI DataGrid with filter in toolbar.我已经在工具栏中使用过滤器实现了 React Material-UI DataGrid。 在此处输入图像描述

once filter menu/popup open, it'll cover the first few rows of the grid/table, i want this popup to open top-start instead of bottom-start.一旦过滤器菜单/弹出窗口打开,它将覆盖网格/表格的前几行,我希望此弹出窗口从顶部开始而不是底部开始。

is there any way i can achieve this?有什么办法可以做到这一点?

After checking the attributes of this filter element, it's a div with a tooltip role.检查此过滤器元素的属性后,它是一个带有tooltip角色的div As a result, we can create a css file and modify the top position of divs with tooltip role as below:因此,我们可以创建一个 css 文件并修改具有tooltip角色的 div 的顶部 position,如下所示:

div[role="tooltip"] {
  top: -60px !important;
}

Sandbox 沙盒

as there isn't any option provided in MUI doc for this issue, I think this would be the best workaround.由于 MUI 文档中没有针对此问题提供任何选项,我认为这将是最好的解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM