I am trying to execute a function called myFunc when double-clicking on a ui-grid row. However, despite using the following code:
<ng-dblclick="grid.appScope.myFunc()">
The function is not being called and there are no errors displayed.
Here is the relevant HTML code snippet:
<div ui-grid="gridOptions" ui-grid-selection class="gridStyle"
ng-dblclick="grid.appScope.myFunc()">
</div>
And here is the corresponding JavaScript script:
var myData = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
var app = angular.module('myApp', ['ui.grid', 'ui.grid.selection']);
app.controller('MainCtrl', function($scope) {
$scope.data = myData;
$scope.mySelections = [];
$scope.gridOptions = {
data :'data',
selectedItems : $scope.mySelections,
enableRowSelection: true,
selectionRowHeaderWidth: 35,
rowHeight: 35,
showGridFooter:true,
enableRowHeaderSelection: false,
multiSelect:false,
enableSelectAll:false,
enableFullRowSelection:true
};
$scope.myFunc = function() {
alert('you double clicked!');
};
});