https://www.ag-grid.com/javascript-grid-column-menu/
I am trying to create a "columnsMenuTab
" on column Header
which consists of checked and unchecked column list in dropdown.
(1) How to check and uncheck checkbox of "columnsMenuTab"(may be in columnDefs).
this.state = {
rowData: [
{ "Name": "", "Id": '', "Priority": "Medium", "Date": "24/08/2008", "Status": "Completed", "gold": 8, "silver": 0, "bronze": 0, "total": 8 }
],
columnDefs: [
{ field: 'Name'}, // checked in columnsMenuTab
{ field: 'Id'}, // checked in columnsMenuTab
{ field: 'Priority'}, // unchecked in columnsMenuTab
{ field: 'Date'}, // checked in columnsMenuTab
{ field: 'Status'} // unchecked in columnsMenuTab
]
}
render() {
return (
<React.Fragment>
<div style={{ width: '100%', height: '100%' }}>
<div className="example-wrapper">
<div id="myGrid" className="ag-theme-alpine" style={{ height: '500px', width: '1024px' }}>
<AgGridReact
columnDefs={this.state.columnDefs}
defaultColDef={this.state.defaultColDef}
overlayLoadingTemplate={this.state.overlayLoadingTemplate}
overlayNoRowsTemplate={this.state.overlayNoRowsTemplate}
onGridReady={this.onGridReady}
rowData={this.state.rowData}
components={this.state.components}
frameworkComponents={this.state.frameworkComponents}
enableRangeSelection={true}
allowContextMenuWithControlKey={true}
icons={this.state.icons}
getContextMenuItems={this.getContextMenuItems}
popupParent={this.state.popupParent}
></AgGridReact>
</div>
)
}
</div>
</div>
</React.Fragment>
)
}
Attached plunker:- https://plnkr.co/edit/XbyFsa49VjfReShq