I am getting the selected rows of my ng-grid and showing certain values in a separated array. My problem is that when I change some values in the selected row, I need to update the element rather than pushing a new pair of values.
$scope.$watch('mySelectedItems', function() {
$scope.gridOptions.selectedItems.forEach(function(entry) {
var myEntry = {unit: entry.myUnit, quantity: entry.qty, sku: entry.sku};
$scope.result1.push(myEntry);
});
}, true);
Note: The mySelectedItems
is just a new array containing the same data in selectedItems[]
(ng-grid's default array)
I know it has to do with the push()
function, but I can't find a way to update the existing pair of values.
Has anyone did something similar in the past?
Thanks!