Robert Christian
Robert Christian

Reputation: 18310

ng-grid edits do not bind to model

Here's an example plunker: http://plnkr.co/edit/9iCNie?p=preview

It's expected that myData changes after a name is edited, but it does not.

HTML:

<body ng-controller="MyCtrl">
    {{myData}}
    <div class="gridStyle" ng-grid="gridOptions"></div>
</body>

JS:

// main.js
var app = angular.module('myApp', ['ngGrid']);
app.controller('MyCtrl', function($scope) {
    $scope.myData = [{name: "Moroni", age: 50},
                     {name: "Tiancum", age: 43},
                     {name: "Jacob", age: 27},
                     {name: "Nephi", age: 29},
                     {name: "Enos", age: 34}];
    $scope.gridOptions = { 
      data: 'myData', 
      enableCellSelection: true,
      canSelectRows: false,
      displaySelectionCheckbox: false,
      columnDefs: [{field: 'name', displayName: 'Name', enableFocusedCellEdit: true}, {field:'age', displayName:'Age'}]
    };
});

I opened an issue here as well https://github.com/angular-ui/ng-grid/issues/182, in case this is a bug.

Upvotes: 1

Views: 1528

Answers (1)

Robert Christian
Robert Christian

Reputation: 18310

It was a bug, and it's fixed in the latest rev. Working plunker here - http://plnkr.co/edit/9iCNie?p=preview

Upvotes: 1

Related Questions