2014-04-07 6 views
0

ng-grid에서 행을 식별, 수정 또는 삭제 또는 삭제하는지 여부를 찾는 방법을 찾고 있습니다.ng-grid 제거 행의 특정 행을 숨기기

행을 제거 할 때 행을 제거하는 대신 행을 숨기고 삭제 된 행이라는 플래그를 설정해야합니다.

누구든지 (클릭하면) ng-grid에서 아이콘/버튼 클릭시 행을 숨길 수 있습니까?

$scope.reasonsGrid = { 
     data: 'myReasons',      
     columnDefs: [ 
      {field: 'remove', displayName:'', cellTemplate: removeTemplate,enableCellEdit: false,width:30}, 
      {field: 'code', displayName: 'Reasons',cellTemplate: dropdownTemplate,enableCellEdit: false}] 
     }; 

var removeTemplate ='span class="glyphicon glyphicon-minus-sign" ng-click="removeItem(row.rowIndex)"/>'; 
$scope.removeItem = function(index) { //hide a row }; 

답변

0

행 뒤에있는 데이터 항목을 수정하고 플래그를 설정할 수 있습니다. 이러한 항목의 필터링 된보기를 반환하는 함수에서 데이터를 읽을 수 있습니다.

$scope.removeItem = function(row) { 
    var dataItem = row.entity; 
    //Do something to dataItem to mark it as deleted 
} 
: 함수 함수에서

var removeTemplate ='<span class="glyphicon glyphicon-minus-sign" ng-click="removeItem(row)"/>'; 

에 행 객체의

패스

관련 문제