Skip to content Skip to sidebar Skip to footer

Set Cell Value Based On A Condition

I have a column binded to a field called state, which has the values: S or L. I want to map this to following: S => Short, L => Long This is how the binding is defined: $scop

Solution 1:

If it helps anyone, I ended up doing this:

let stateTemplate = "<div>{{row.entity.state == 'L' ? 'Buy' : 'Sell'}}</div>"

$scope.gridOptions = {
      enableSorting: true,
      enableFiltering: true,
      enableHorizontalScrollbar: 0,
      columnDefs: [
        {name: 'action', field: 'state', cellTemplate: stateTemplate, enableFiltering: false}
],
data: someData
    };

Post a Comment for "Set Cell Value Based On A Condition"