1

Angular Js ui-grid を作成しました。最後の列はボタンで構成されています。そのボタンをクリックすると、その行の各セルのデータを取得する必要があります。誰かがこれを理解するのを手伝ってくれれば幸いです。

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
        };

ここに画像の説明を入力

4

1 に答える 1

1

row.entityテンプレート関数に追加する
と、オブジェクト プロパティ (行セル) にアクセスできるようになります。

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

コントローラーの関数がパラメーターを取得することを確認します。

$scope.removeRow = function (selectedRowObject) {
            //Your logic...
        };
于 2016-06-01T07:15:37.730 に答える