简体   繁体   English

Material-UI:X-Grid / DataGrid 默认 ColumnMenu 未显示

[英]Material-UI: X-Grid / DataGrid Default ColumnMenu Not Showing

I'm implementing the x-grid on my project, and the ColumnMenu is not showing when the 3dots are clicked: popup not displaying when 3-dots are clicked我正在我的项目中实现 x-grid,当单击 3 点时没有显示 ColumnMenu:单击3 点时不显示弹出窗口

Based on the documentation it appears the default behaviour of the ColumnMenu is to appear on a click event.根据文档,ColumnMenu 的默认行为似乎出现在单击事件上。

The event is getting fired because I was able to capture it in a console.log .该事件被触发,因为我能够在console.log中捕获它。 It has made me wonder if the dependencies are not met for the x-grid.这让我想知道 x-grid 是否不满足依赖关系。 However I have the latest version of x-grid and very new version of the core package.但是我有最新版本的 x-grid 和非常新版本的核心 package。 Below is a snippet from my yarn.lock:下面是我的 yarn.lock 的一个片段:

"@material-ui/x-grid@^4.0.0-alpha.20":
  version "4.0.0-alpha.20"
  dependencies:
    "@material-ui/utils" "^5.0.0-alpha.14"
    "@material-ui/x-license" "^4.0.0-alpha.20"
    prop-types "^15.7.2"
    reselect "^4.0.0"

"@material-ui/core@^4.1.1":
  version "4.11.0"
  dependencies:
    "@babel/runtime" "^7.4.4"
    "@material-ui/styles" "^4.10.0"
    "@material-ui/system" "^4.9.14"
    "@material-ui/types" "^5.1.0"
    "@material-ui/utils" "^4.10.2"
    "@types/react-transition-group" "^4.2.0"
    clsx "^1.0.4"
    hoist-non-react-statics "^3.3.2"
    popper.js "1.16.1-lts"
    prop-types "^15.7.2"
    react-is "^16.8.0"
    react-transition-group "^4.4.0"

My project is currently running react & react-dom v.16.13.1 , which mets the minimum requirement for @material-ui/core我的项目目前正在运行react & react-dom v.16.13.1 ,它满足 @material-ui/core 的最低要求

This what my x-grid currently looks like:这就是我的 x-grid 目前的样子:

         <XGrid
          rows={rows}
          columns={columns}
          rowHeight={38}
          checkboxSelection
          hideFooterSelectedRowCount
          page={page}
          pageSize={rowsPerPage}
          pagination
          paginationMode="server"
          components={{
            Toolbar: () => (
              <XGridToolbar
                title="Titles"
                rowsSelected={selectedRows.length}
                onToolbarDeleteClick={setDeleteDialogOpen}
                onToolbarEditClick={this.handleEditClick}
              />
            ),
          }}
          onSelectionModelChange={this.handleSelectedRows}
          sortingMode="server"
          sortModel={orderBy}
          onSortModelChange={this.handleHeaderClick}
          onPageChange={this.handlePageChange}
          onPageSizeChange={this.handleRowsPerPageChange}
          rowsPerPageOptions={defaultRowsPerPageOptions}
          rowCount={totalCount}
        />

I've tried manually setting the ColumnMenu in the components prop to the default GridColumnMenu but I had no luck.我尝试将components道具中的 ColumnMenu 手动设置为默认的GridColumnMenu但我没有运气。 I've also tried removing all my modifications and trying to get it to work with the just the columns and rows props provided but that didn't work either.我还尝试删除所有修改并尝试使其仅与提供的columnsrows道具一起使用,但这也不起作用。

Also, when I used the default Toolbar the icons would appear, however when clicked they wouldn't bring up the panel either.此外,当我使用默认Toolbar时,会出现图标,但是单击时它们也不会显示面板。

Has anyone else experienced this?有没有其他人经历过这个? Is this a dependency issue?这是一个依赖问题吗?

Thanks for any help in advance.感谢您提前提供任何帮助。 I've been searching for the answer everywhere.我一直在到处寻找答案。

It seems to be a duplicate of https://github.com/mui-org/material-ui-x/issues/946 .它似乎是https://github.com/mui-org/material-ui-x/issues/946的副本。 But hard to tell as not minimal live reproduction was provided.但很难说,因为没有提供最小的现场复制。

Solved: The issue was that the z-index was being inherited from our component.已解决:问题是 z-index 是从我们的组件继承的。 I didn't think to look there originally, because this hasn't effect any other popover or snack bar.我原本没想到那里看,因为这并没有影响任何其他弹出窗口或小吃店。

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

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