0

The ngx-datatable cell styling example (http://swimlane.github.io/ngx-datatable/#css) uses the cell value as the condition. I want to use a variable in the component that I can change in any component method. I tried doing it in getCellClass(), but to my surprise, even variables declared are undefined.

This code works for the styling the <div> inside the cell, but I want to apply a style to the entire cell (or get the div to fill the entire cell).

<ngx-datatable-column name="First Name" prop="firstname">
  <ng-template let-column="column" ngx-datatable-header-template> {{column.firstname}} </ng-template>
    <ng-template let-row="row" let-rowIndex="rowIndex" let-value="value" width="60px" ngx-datatable-cell-template>
  <div [style.background]="personCurrent == rowIndex ? 'SlateGray' : ''">
   <p>{{value}}</p>
  </div>
 </ng-template>
</ngx-datatable-column>
beachCode
  • 3,202
  • 8
  • 36
  • 69

1 Answers1

0

I'm using a workaround. I'm writing the component variable to a hidden column in the datatable and then using that value.

beachCode
  • 3,202
  • 8
  • 36
  • 69