rowGroupPanelShow的状态更改后的刷新刷新

时间:2020-08-31 15:31:34

标签: ag-grid ag-grid-react

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

Code

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

1 个答案:

答案 0 :(得分:1)

一种快速获取所需内容的简单方法是通过CSS隐藏该组件。请记住为您的表提供唯一的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>

实时示例

Edit AgGrid Toggle Row Group Panel