I have an ng-grid with data and each row has a button for edit and cancel . When edit button is clicked the row data can be edited. So here if I dont want to save the editted data I click cancel .When edit is clicked I copy the original value of the row with
angular.copy(row.entity,$scope.data) ;
So now after editting few values I want to cancel the edit and i click cancel button. when cancel button is clicked I want the grid to show the original value before edit.How can I change.
Please help
I was trying to replace the whole row of ng grid in a single line as
row.entity = $scope.tempArray
which didnt work Then I tried replacing cell be cell.It worked
I created an array for temporary storage.
$scope.tempArray = {
data1:"",
data2:""
}
in edit function I copied the row data to tempArray as
$scope.tempArray.data1 = row.entity.col1;
$scope.tempArray.data2 = row.entity.col2;
in cancel function the row data is set back to original as
row.entity.col1 = $scope.tempArray.data1;
row.entity.col2 = $scope.tempArray.data2;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.