将rowGroupPanelShow从“始终”更改为“从不”后,组面板顶部不会隐藏。 我是否需要从Grid实例调用任何refreshView方法?
this.setState({ rowGroupPanelShow: 'never' });
答案 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>