ui-grid 中的单元格点击回调

Callback on cell click in ui-grid

我想要一个回调函数,每次单击单元格时都会触发该回调函数。因此,我使用了以下回调:

gridAPI.cellNav.on.navigate($scope, function (newRowCol, oldRowCol)

但它的问题是,当我第二次单击同一个单元格时,我无法触发该功能。为了为此被解雇,应该选择一个不同的单元格。因此only-first-click-on-cell就是这样。

有没有我可以在每次点击时触发的回调?

没有,据我所知,目前cellClick没有任何回调。

我能写的最好的技巧:

$scope.cellClicked = function (row, col){
 // do with that row and col what you want
}

每列的单元格模板:

cellTemplate: '<div>
   <div ng-click="grid.appScope.cellClicked(row,col)" class="ui-grid-cell-contents" title="TOOLTIP">{{COL_FIELD CUSTOM_FILTERS}}</div>
      </div>',

不要用那个,最好用:

rowTemplate: `
    <div
        ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid"
        ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'"
        class="ui-grid-cell"
        ng-click="grid.appScope.$ctrl.yourFunction(row)"
        ng-class="{ 'ui-grid-row-header-cell': col.isRowHeader }"
        role="{{col.isRowHeader ? 'rowheader' : 'gridcell'}}"
        ui-grid-cell>
    </div>`,