Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks I found a solution thanks to the Angular <a href="https://groups.google.com/forum/?fromgroups=#!topic/angular/PP_r1B5ivE8">mailing list</a>. It was pointed that AngularJS is missing the onBlur event (as well as the onFocus). However, this can be overcome by adding a "simple" directive.</p> <pre><code>angular.module('myApp.ngBlur', []) .directive('ngBlur', function () { return function (scope, elem, attrs) { elem.bind('blur', function () { scope.$apply(attrs.ngBlur); }); }; }); </code></pre> <p>As information, there is another example of implementation related to the blur event directive <a href="http://www.grobmeier.de/angular-js-autocomplete-and-enabling-a-form-with-watch-and-blur-19112012.html">here</a>. </p> <p>Then, the rest of the code in the controller looks like:</p> <pre><code>// Define the template of the cell editing with input type "number" (for my case). // Notice the "ng-blur" directive var cellEditableTemplate = "&lt;input style=\"width: 90%\" step=\"any\" type=\"number\" ng-class=\"'colt' + col.index\" ng-input=\"COL_FIELD\" ng-blur=\"updateEntity(col, row)\"/&gt;"; // Configure ng-grid $scope.gridOptions = { data: 'questions', enableCellSelection: true, multiSelect: false, columnDefs: [ {field: 'id', displayName: 'Id'}, {field: 'name', displayName: 'Name'}, // Notice the "editableCellTemplate" {field: 'answers[0].valuePercent', displayName: 'Rural', enableCellEdit: true, editableCellTemplate: cellEditableTemplate} ] }; // Update Entity on the server side $scope.updateEntity = function(column, row) { console.log(row.entity); console.log(column.field); // code for saving data to the server... // row.entity.$update() ... &lt;- the simple case // I have nested Entity / data in the row &lt;- the complex case // var answer = new Answer(question.answers[answerIndex]); // answerIndex is computed with "column.field" variable // answer.$update() ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload