【问题标题】:How to hide AG-Grid once I click button to show some popup (modal)单击按钮以显示一些弹出窗口(模态)后如何隐藏 AG-Grid
【发布时间】:2021-11-17 03:42:15
【问题描述】:

单击按钮以显示一些弹出窗口(模式)后,如何隐藏 AG-Grid https://www.ag-grid.com/。其他所有元素都被模态背景“覆盖”。但是 AG Grid 位于模态之上。启用模式后如何隐藏网格?至少如何在 AG Grid 之上呈现模态?应用程序是使用 React 开发的。

.modalBackground {
    width: 100vw;
    height: 100vh;
    background-color: rgba(200, 200, 200);
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center ;
  }

【问题讨论】:

    标签: javascript reactjs ag-grid


    【解决方案1】:

    为您的 modalBackground 类添加一个 z-index 属性。这个类的 div 也需要是 body 标签的子标签。

    .modalBackground {
      width: 100vw;
      height: 100vh;
      background-color: rgba(200, 200, 200);
      position: fixed;
      display: flex;
      justify-content: center;
      align-items: center ;
      z-index: 1;
    }
    

    【讨论】:

    • 那行得通。谢谢。我通过添加状态来更改 style={{display: showGrid}} 解决方法,其中 showGrid 可以是“none”或“flex”。但这更干净。
    猜你喜欢
    • 2018-09-09
    • 1970-01-01
    • 2020-02-12
    • 1970-01-01
    • 2023-04-09
    • 2019-08-06
    • 1970-01-01
    • 2016-04-05
    • 1970-01-01
    相关资源
    最近更新 更多