所以我试图让我的Angular UI Grid在整行上注册一个双击事件来打开一个模态。我可以从toasttr吐司开始然后从那里开始。这是我最接近的基于各种演示和在线示例,但我似乎无法让它工作。
控制器:
$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方法以及其他所有方法,但我无法让它工作。我在哪里,完全没有?