2016-06-01 5 views

답변

1

템플릿 기능에 row.entity 추가

var removeTemplate = '<input type="button" value="" style="background: url(../../Content/images/del-currency.png);widht:60px;height:30px" ng-click="removeRow()" />'; 
    $scope.selectedCurrencyGrid = { 
        data: 'selectedCurrencies', 
        multiSelect: false, 
        selectedItems: $scope.selectedCurrencyRow, 
        enableColumnResize: false, 
        enableRowSelection: true, 
        columnDefs: [ 
          { field: 'Name', displayName: 'Name' }, 
          { 
           field: 'IsDefault', 
           displayName: 'Default', 
           cellTemplate: '<input type="radio" name="radAnswer" ng-model="row.entity.IsDefault">' 
          }, 
          { name: 'Photo', field: 'photoP', displayName: '', cellTemplate: removeTemplate } 
        ] 

       }; 


$scope.removeRow = function() { 
      var index = this.row.rowIndex; 
      //need to get cell data of selected row 
     }; 

,
이 있습니다 (행 세포) 개체 속성에 액세스 할 수 있습니다 :

<input type="button" value="" style="background: url(../../Content/images/del currency.png);widht:60px;height:30px" ng-click="removeRow(row.entity)" />';

하는 것은 당신의 기능 확인 conteroller는 매개 변수를 얻습니다.

$scope.removeRow = function (selectedRowObject) { 
      //Your logic... 
     }; 
+0

정확히 내가 원했던 것입니다. soo 많이 고마워요. –

+0

문제 없습니다, 나는 그들의 문서를 보길 권합니다. 그들은 많은 훌륭한 기능을 가지고 있습니다. http://ui-grid.info/docs/#/api – AranS