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>