rowGroupPanelShow 状态更改后的 Aggrid 刷新

Aggrid refresh after state of rowGroupPanelShow changed

rowGroupPanelShow 从“始终”更改为“从不”后,组面板顶部不会隐藏。 我需要从 Grid 实例调用任何 refreshView 方法吗?

Code

this.setState({ rowGroupPanelShow: 'never' });

快速获得所需内容的一种简单方法是通过 css 隐藏该组件。请记住为您的 table 提供一个唯一的 ID,这样您就可以找到确切的组件来切换可见性

设置

const showRowGroupPanel = () => {
  const el = document.querySelector(`#myTableId .ag-column-drop-wrapper`);
  el.style.display = "";
};
const hideRowGroupPanel = () => {
  const el = document.querySelector(`#myTableId .ag-column-drop-wrapper`);
  el.style.display = "none";
};

...

<button onClick={showRowGroupPanel}>Show</button>
<button onClick={hideRowGroupPanel}>Hide</button>
<div
  style={{ height: "100%", width: "100%" }}
  className="ag-theme-balham"
  id="myTableId"
>
  <AgGridReact {...}/>
</div>

实例