Angular JS UI-Grid Delete Row

后端 未结 5 498
野趣味
野趣味 2021-02-05 16:47

I\'m new to ui-grid and I\'m trying to implement a table in AngularJS as shown in the picture below. I\'m trying to select a row and delete it using a delete button

5条回答
  •  孤街浪徒
    2021-02-05 17:41

    We need to use the $scope.grid.appScope. It is available in all templates. Besides that, you need to send the row object from the template, so that you can delete the row from the grid data.

    jsfiddle: http://jsfiddle.net/3ryLqa9e/4/

      cellTemplate:'' 
    
      $scope.Delete = function(row) {
                var index = $scope.gridOptions.data.indexOf(row.entity);
                $scope.gridOptions.data.splice(index, 1);
            };
    

提交回复
热议问题