Reputation: 65
Right now when I change the %Discount field value, the "Product Column Dynamic Total" changes. I also want the "x (default)" column cell values to change as well in respect of the % change.
https://plnkr.co/edit/B40h9XrKOcNly7M0HG0u?p=preview
Product Column Dynamic Total >> {{grandTotal - (discount / 100) * grandTotal}} <<
Upvotes: 0
Views: 1042
Reputation: 316
Forked your plunker to change value of "x (default)" column with some random values.
Code:
angular.forEach($scope.myData,function(row,idx){
row.x = Math.random();
});
It is not advised to used watchers to implement a functionality. Instead use functions.
Upvotes: 0
Reputation: 734
You can listen to change and update $scope.myData
when discount
changes. Since, ui-grid
has two way binding for $scope.myData
it will update the view.
You input
tag will look like:
<input class="form-control " data-ng-model="discount" ng-change="updateValues()" type="number">
then add the updateValues
function to your $scope
:
$scope.updateValues = function() {
// write code to update values here
}
Upvotes: 1