Angular ui网格双击事件设置 [英] Angular ui grid double click event setup

查看:114
本文介绍了Angular ui网格双击事件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想让我的Angular UI Grid在整个行上注册一个双击事件以打开模式.我可以从烤面包片开始,然后从那里开始.这是我根据各种在线演示和示例得出的最接近的结果,但是我似乎无法使其正常工作.

So I'm trying to get my Angular UI Grid to register a double click event on an entire row to open up a modal. I can start with a toastr toast and go from there though. This is the closest I've come based on various demos and examples online, but I just can't seem to get it to work.

控制器:

$scope.gridHandlers = {
  onDblClick: function(rowItem){
    toastr.success(rowItem, 'Row Item:')
  }
}
$scope.gridOptions = {
  onRegisterApi : function(gridApi){
    $scope.gridApi = gridApi
  },
  data: $scope.customerList,
  enableRowHeaderSelection: false,
  enableRowSelection: true,
  enableSelectAll: false,
  multiSelect: false,
  noUnselect: true,
  rowTemplate: '<div ng-dblclick="getExternalScopes().onDblClick(row)" external-scopes="gridHandlers" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name\" class=\"ui-grid-cell\" ng-class=\"{ \'ui-grid-row-header-cell\': col.isRowHeader }\" ui-grid-cell></div>',
  columnDefs : [
  {name: 'name', type: 'string'},
   ...etc
  {name: 'status_name', displayName: 'Status', width: '11%', type: 'string'}
]

查看:

<div class="large-12 cols" ui-grid="gridOptions" ui-grid-selection external-scopes="gridHandlers">

我尝试使用他们谈论的grid.appScope方法以及其他所有方法,但是我无法使其正常工作.我在哪儿,完全不在?

I've tried using the grid.appScope methods they talk about and everything else, but I just can't get it to work. Where am I here, totally off?

推荐答案

grid.appScope对我有用.请参阅 plnkr (双击任何行以查看行数据)

grid.appScope did work for me. Please see the plnkr (Double click on any row to see the row data)

这篇关于Angular ui网格双击事件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆