0
我有兩個NG-電網頁,我想用兩個相應的ngGridEventEndCellEdit
事件:如何區分NG-電網事件,在單頁兩個網格
<div id="grid1" class="gridStyle" ng-grid="gridOptions1"></div>
<div id="grid2" class="gridStyle" ng-grid="gridOptions2"></div>
function HomeCtrl($scope, $http) {
$scope.columns = [{ field: 'name', displayName: 'Name', enableCellEdit: false }, { field: 'age', displayName: 'Age', enableCellEdit: false }];
$scope.gridOptions1 = {
data: 'myData', enablePinning: true, enableCellEdit: true, enableRowSelection: false,
columnDefs: 'columns'
};
$scope.columns2 = [{ field: 'name1', displayName: 'Name', enableCellEdit: false }, { field: 'Age1', displayName: 'Age', enableCellEdit: false }];
$scope.gridOptions2 = {
data: 'myData2', enablePinning: true, enableCellEdit: true, enableRowSelection: false,
columnDefs: 'columns2'
};
$scope.myData = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
$scope.myData2 = [{name1: "Moroni", age1: 50},
{name1: "Tiancum", age1: 43},
{name1: "Jacob", age1: 27},
{name1: "Nephi", age1: 29},
{name1: "Enos", age1: 34}];
}
有兩個網格,和我想根據網格編號在單元格編輯上選擇ngGridEventEndCellEdit
兩個不同的事件。我怎樣才能做到這一點 ?
//for grid1
$scope.$on('ngGridEventEndCellEdit', function (data) {
};
//for grid2
$scope.$on('ngGridEventEndCellEdit', function (data) {
};