2016-06-01 7 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

これはまさに私が欲しかったことです。ありがとうございました –

+0

問題はありませんが、私は彼らのドキュメントを見ることをお勧めします、彼らは素晴らしい機能がたくさんあります。 http://ui-grid.info/docs/#/api – AranS

関連する問題