hi,
I have a button column which has 4 buttons and i want to get clicked buttons row data.
onselectionchanged event i am getting selectedrow but buttons click event fired before selection changed event.
after program start first click on button selection is null. second or the other clicks selection will become previous row because click code firing before selection changed event.
Button column click code
render={({ row }) => (
<div>
<a href="javascript:void(0)" onClick={() => this.getSelectedRow(this)}>click me</a>
</div>
)}
function
getSelectedRow() {
console.log(this.state.selection);
}
grid selection code
<DataGrid data={this.state.data} style={{ height: 250 }}
selectionMode="single"
selection={this.state.selection}
onSelectionChange={(selection) => this.setState({ selection: selection })}
>
And i have second question
How can i access datagrid object for use methods such as "toggleRow"
Thanks