angularjs - ng-blur event does not work on ui-grid cell template -
here sample code. have cell template (text box) within ui-grid. use ng-blur event when value of text box changes event not fire.
{ name: "amount", displayname: "amount", enablefiltering: false, celltemplate: '<input type="text" ng-model="row.entity.amount" ng-blur="updateentity(row.entity)"></input>' }
has cross scenario or used ng-blur within ui-grid's cell template. thank you.
u can use native api that:
$scope.gridoptions.onregisterapi = function(gridapi){ //set gridapi on scope $scope.gridapi = gridapi; gridapi.rowedit.on.saverow($scope, $scope.saverow); }; $scope.saverow = function( rowentity ) { // create fake promise - you'd use promise returned $http or $resource var promise = $q.defer(); $scope.gridapi.rowedit.setsavepromise( rowentity, promise.promise ); // or call logics here returning promise.reject() - on error or promise.resolve() - on success // fake delay of 3 seconds whilst save occurs, return error if gender "male" $interval( function() { if (rowentity.gender === 'male' ){ promise.reject(); } else { promise.resolve(); } }, 3000, 1);
tutorial link http://ui-grid.info/docs/#/tutorial/205_row_editable
Comments
Post a Comment