ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

is posible undo edits cells?

Open eduard10000 opened this issue 10 years ago • 2 comments

i don't find anything fot this. can this a new features?

eduard10000 avatar Apr 05 '16 20:04 eduard10000

Currently, I guess such feature is not existed. But you can work around it by having a cache-ish object array to store pre-changed values.

[{column: x, row: y, data: data:soemthing}, {column: x: row: y: data:soemthing}].

When data is about to change, put it property to this array, if undo is clicked, revert the data grid cell with the last item from the array.

stevenlius avatar Apr 06 '16 14:04 stevenlius

It works to undo or revert cell edit changes. Just one codeline.

$scope.gridApi.edit.on.afterCellEdit( $scope , function (rowEntity , colDef , newValue , oldValue ) {
    rowEntity[colDef.name] = oldValue;
});

It takes the selected column name on the selected row to get the selected cell . Then, it just left to assign old value to that cell.

ladislaogarcia avatar Feb 08 '17 13:02 ladislaogarcia