arunkumar
arunkumar

Reputation: 353

Ag Grid - On cancel reset table to original state

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

Answers (1)

Desha
Desha

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

Related Questions