In React and based on the docs [here][1], I'm trying to select an AG Grid row for removal with this code:
class MyComponent extends Component {
constructor(props) {
this.state={rowSelection: 'single'}
}
onGridReady(params) {
this.gridApi = params.api
this.columnApi = params.columnApi
}
onRemoveSelected() {
const selectedData = this.gridApi.getSelectedRows();
const res = this.gridApi.updateRowData({ remove: selectedData })
}
}
render() {
return(
<div>
<button onClick={this.onRemoveSelected.bind(this)}>Remove Selected</button>
<AgGridReact
id="myGrid"
{...gridOptions}
onGridReady={this.onGridReady}
rowSelection={this.state.rowSelection}
/>
</div>
)
}
But the row is not selecting. Also, using different variations of the code, there are times were I get this console warning:
cannot select node until id for node is known
Thanks in advance [1]: https://www.ag-grid.com/javascript-grid-data-update/