Hello my fellows !
Lets discuss and resolve my problem with removing a selected row in ng-grid
Lets say i have this data in my ng-grid:
$scope.SelectedgridValue = []
app.controller('MyCtrl', function($scope) {
$scope.myData().Creon3 = [{name: "Switch", id: 50},
{name: "Death switch", id: 43},
{name: "Target", id: 27},
{name: "Freedom", id: 29},
{name: "Epic", id: 34}];
$scope.gridOptions = {
data: 'myData().Creon3',
showSelectionCheckbox: true,
enableRowSelection: true,
columnDefs: [{field: 'State', displayName: 'Name'},
{field:'ID', displayName:'Id'}]
};
Now to delete a selected row i dont use any grid template or button witch is directly bounded to grid.
My delete function is bounded to submit function from a separated button on my view ...
Delete function is done like this :
$scope.deleteSelectedRow = function () {
angular.forEach($scope.SelectedgridValue , function (rowItem) {
$scope.myData().Creon3.splice($scope.myData().Creon3.indexOf(rowItem.Name),1);
});
}
And my submit function is as folows...
$scope.submit = function (data) {
-- Some code ....
},
function (data) {
$scope.deleteSelectedRow()
$route.reload();
$scope.loadingEnd();
});
The problem with this approach is at nothing is happening , i can't remove selected row... what is wrong ?
Please assist...
What I have tried:
See code in explanation.... WEB , WIKI , Forums , etc etc .... etc....