Gabriel
Gabriel

Reputation: 969

ag-grid with ReactJS rowDataChanged not raised

i'm facing a trouble using ag-grid with react.

Everything works fine, but when the data is updated the event rowDataChanged is not raised.

Try 1:

<AgGridReact
    // properties
    columnDefs={this.state.columnDefsStockMarca}
    rowData={this.state.dataStockMarca}
    rowSelection='single'
    enableSorting
    enableColResize
    // events
    onGridReady={this.onGridReady}
    rowDataChanged={(p) => {
       alert('Hi');
    }}>
</AgGridReact>

Try 2:

class MyComponent extends Component {

...

dataChanged(params) {
    alert('Hi');
}
...

render {
return(
<AgGridReact
    // properties
    columnDefs={this.state.columnDefsStockMarca}
    rowData={this.state.dataStockMarca}
    rowSelection='single'
    enableSorting
    enableColResize
    // events
    onGridReady={this.onGridReady}
    rowDataChanged={this.dataChanged}>
</AgGridReact>
);
}

also try with modelUpdated event, but with no luck.

The data is updated through setState, and works ok.

Upvotes: 1

Views: 2454

Answers (1)

CS-
CS-

Reputation: 137

Should use onRowDataChanged instead

Upvotes: 1

Related Questions