Reputation: 3678
I'm creating a simple demo using this link http://ui-grid.info/docs/#/tutorial/101_intro . I am able to get click event (Please click on first column edit image). It shows a modal. I open a modal on click of image. It show pre-filled entries of selected item. I also able to get click buttons (save and cancel) present in model, but I want this: if a user changes the first and second present in input field, it reflects in table when the user presses save button.
Here is my code: http://plnkr.co/edit/PLy6rSUIOMoVO6iKfPOY?p=preview
.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, row, grid) {
var vm=this;
console.log(row);
vm.first=row.entity.name;
vm.second=row.entity.lastname;
vm.save = function () {
alert('save')
};
vm.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
});
Upvotes: 0
Views: 133
Reputation: 13600
It's quite simple:
vm.save = function () {
row.entity.name = vm.first
row.entity.lastname = vm.second
$uibModalInstance.dismiss('cancel');
};
As you still have reference and that each controller seem to be created with its own row, then you can simply save the data back into the row.entity
object. As simple as that.
Upvotes: 0