admin管理员组

文章数量:1287121

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?

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?

Share Improve this question edited Oct 18, 2015 at 17:00 royhowie 11.2k14 gold badges53 silver badges67 bronze badges asked Oct 18, 2015 at 15:41 AsqanAsqan 4,48912 gold badges62 silver badges103 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 10

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>',

Don't use that, it's better to use:

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>`,

本文标签: javascriptCallback on cell click in uigridStack Overflow