I am trying to display a list of Strings (array) in a ui-grid table and allow the user to create new entries in the list.
In the first item added, everything works fine (the item is added and the user can update it). After this, for every item added, the changes did previously are being lost.
Link to reproduce the issue (with steps to reproduce): http://plnkr.co/edit/d3b8IYGVM6sMaALN
Am I missing something? Do some of you have a clue about how to solve it?
Thank you in advance!
Code:
$scope.gridOptions = {
enableSorting: true,
enableGridMenu: true,
gridMenuCustomItems: [
{
title: 'Add',
action: function ($event) {
$scope.gridOptions.data.push("New item");
},
order: 210
}
],
columnDefs: [
{ name:'Name', field: uiGridConstants.ENTITY_BINDING }
],
data : [
"John Rogers",
"David Michaels",
"Andrew Johnson",
"Donald McDonald"
]
};
}]);