Reputation: 353
When users modify any data in the table and on click of the cancel button i need to restore the data to original state .
Issue is, resetRowData() function is not resetting the original value but instead it deletes all the record in the table. Please help
Note: I'm using Angular 2
resetRowData() {
this.rowData = [];
this.gridOptions.api.setRowData(this.rowData);
}
<button class="secondary-btn btn-pair" (click)="onCancelRowClicked()">Cancel</button>
Upvotes: 1
Views: 4656
Reputation: 131
There is an API provided by Ag-Grid. If you pass true as the parameter, data will be reset to the original value.
api.stopEditing(true);
Ref - https://www.ag-grid.com/javascript-grid-cell-editing/#editing-api
Upvotes: 2