Angular JS ui-grid 双击行不起作用

2023-12-23

我想在双击 ui-grid 行时调用函数 myFunc。 因为我用过

<ng-dblclick="grid.appScope.myFunc()">

但它没有被调用并且没有显示任何错误。

这是 html 的调用部分:

<div ui-grid="gridOptions" ui-grid-selection class="gridStyle" 
    ng-dblclick="grid.appScope.myFunc()">
</div>

这是js脚本:

    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,
                     //enableSelectAll: true,
                     selectionRowHeaderWidth: 35,
                     rowHeight: 35,
                     showGridFooter:true,
                     enableRowHeaderSelection :false,
                     multiSelect:false,
                     enableSelectAll:false,
                     enableFullRowSelection:true,
                   //  noUnselect: true
                 }


$scope.myFunc = function ()
                         {
                       alert('you double clicled!');
                          };



                    .
                    .
                    .
                    .

      });

指令名称中的拼写错误。

它应该是

ng-dblclick="grid.appScope.myFunc()"

代替

ngdblclick="grid.appScope.myFunc()"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Angular JS ui-grid 双击行不起作用 的相关文章

随机推荐