1

I am using a UI grid of angular. I want to customize the CSS style of one particular cell for all rows in the grid based on some check.

I am trying:

$scope.gridOpts.columnDefs[2].cellTemplate='something'

if some condition is met, else use some other cellTemplate

While debugging the issue, its going inside that condition and evaluating the cellTemplate for the first time but second time its taking the same value of cellTemplate even when the condition is changed until page is refreshed again.

Please help on this.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user2865480
  • 51
  • 1
  • 6

1 Answers1

0

From the description of your problem, it looks like using cellClass will be better suited for your requirement.
You could use something like -

cellClass: function(grid, row, col, rowRenderIndex, colRenderIndex) {
          if (colRenderIndex == 2) {
            return 'blue';
          }

You should refer to this tutorial here - UI Grid Cell Class

Here is another example by the makers of UI grid.

Pratik Bhat
  • 7,166
  • 2
  • 35
  • 57