Material-UI DataGrid 列过滤器不适用于 Material-UI 对话框

1 javascript reactjs material-ui

所以我有以下问题:我在 React JS 中制作了一个 Material-UI DataGrid,我想在 Material-UI DialogContent 中使用它。当放入对话框中时,表中的所有内容都可以正常工作 - 排序、renderCells、checkboxSelection 等,但使用默认过滤除外。这是一个重现该错误的简单示例:https://codesandbox.io/s/relaxed-stallman-sev7x ?file=/src/demo.js

单击列名称/选项,然后单击“过滤器”会出现错误,即您无法在过滤器字段中键入内容。有谁知道这个问题的解决方案吗?

提前致谢,如果问题措辞错误或重复,请先在此处发布,抱歉

小智 6

将disableEnforceFocus 添加到Dialog 组件。

  <Dialog disableEnforceFocus fullWidth maxWidth="xl" open={true} onClose={this.onClose}>
    <DialogTitle>Test Dialog Grid</DialogTitle>
    <DialogContent>t>
      <div style={{ backgroundColor: "white" }}>
        <DataGrid columns={columns} rows={rows} autoHeight />;
      </div>
    </DialogContent>
  </Dialog>
      <div style={{ backgroundColor: "white" }}>
        <DataGrid columns={columns} rows={rows} autoHeight />;
      </div>
  </div>
Run Code Online (Sandbox Code Playgroud)