Title: Datagrid - How to get buttons row data Post by: spider58 on December 12, 2018, 01:07:10 AM 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 Code: render={({ row }) => ( function Code: getSelectedRow() { grid selection code Code: <DataGrid data={this.state.data} style={{ height: 250 }} And i have second question How can i access datagrid object for use methods such as "toggleRow" Thanks Title: Re: Datagrid - How to get buttons row data Post by: stworthy on December 12, 2018, 01:33:19 AM Please pass the 'row' to your clicking handler function.
Code: <a href="javascript:void(0)" onClick={() => this.getSelectedRow(row)}>click me</a> Title: Re: Datagrid - How to get buttons row data Post by: spider58 on December 12, 2018, 01:41:11 AM Please pass the 'row' to your clicking handler function. Code: <a href="javascript:void(0)" onClick={() => this.getSelectedRow(row)}>click me</a> hi. Thanks for answer i tried already Code: getSelectedRow(row) { still getting previous row data But i can access row data with row. i will use row not use state ;D and another question how can i use methods such as (toggleRow) Title: Re: Datagrid - How to get buttons row data Post by: stworthy on December 12, 2018, 06:41:32 PM Use this code instead.
Code: this.setState({ selection: row}, ()=>{ |