Search code examples
javascriptangularjsng-gridangular-ui-grid

Callback on cell click in ui-grid


I want to have a callback function which is fired each time when a cell is clicked. Therefore, i was using the following callback:

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

But the problem with it is that i can't fire that function when the same cell second time is clicked. In order to be fired for this, a different cell should be selected. Thus only-first-click-on-cell is this.

Is there any callback which i can fire on each click?


Solution

  • No, currently there is no any callback for cellClick as far as i see.

    The best trick i could write:

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

    Cell template on each column:

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