Angular ui grid双击事件设置 [英] Angular ui grid double click event setup
问题描述
所以我试图让我的 Angular UI Grid 在整行上注册一个双击事件来打开一个模式.我可以从吐司吐司开始,然后从那里开始.这是我根据各种在线演示和示例得出的最接近的结果,但我似乎无法让它发挥作用.
控制器:
$scope.gridHandlers = {onDblClick:函数(rowItem){toastr.success(rowItem, 'Row Item:')}}$scope.gridOptions = {onRegisterApi:函数(gridApi){$scope.gridApi = gridApi},数据:$scope.customerList,enableRowHeaderSelection: 假,enableRowSelection: 真,启用全选:假,多选:假,没有取消选择:真,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>',列定义:[{名称:'名称',类型:'字符串'},...等等{名称:'status_name',显示名称:'状态',宽度:'11%',类型:'字符串'}]
查看:
我试过使用他们谈论的 grid.appScope 方法和其他所有方法,但我无法让它工作.我在哪里,完全不在?
解决方案 grid.appScope
对我有用.请参阅plnkr(双击任意行可查看行数据)
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.
Controller:
$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'}
]
View:
<div class="large-12 cols" ui-grid="gridOptions" ui-grid-selection external-scopes="gridHandlers">
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
did work for me. Please see the plnkr (Double click on any row to see the row data)
这篇关于Angular ui grid双击事件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文