Есть ли способ настроить цвет отдельных ячеек в ngx-datatable angular2? - PullRequest
0 голосов
/ 02 октября 2018

Есть ли способ настроить цвет отдельных ячеек в ngx-datatable?Я вижу, что getCellClass только помогает мне настроить цвет для всей строки.Вставить то, что у меня сейчас есть, здесь -

файл TS -

getCellClass = ({ row, column, value }): any => {

return {
  'cell-color': this.findModification(row)
};
}


findModification(row)
{

if(mytestJSON[row._id].length!=0) {
  return true;
}
else {
  return false;
}
}

У меня есть это в моем файле CSS, чтобы изменить цвет:

/deep/ .cell-color 
{
    background-color: blue;
}

Фрагмент файла HTML:

<ngx-datatable
  class="material pointer"
  [rows]="data"
  [columnMode]="'force'"
  [headerHeight]="50"
  [footerHeight]="0"
  [rowHeight]="'auto'"
  [limit]="10"
  [selectionType]="'single'"
  [scrollbarH]="true"

   >

  <ngx-datatable-column  [cellClass]="getCellClass" *ngFor="let col of myColumns" prop={{col.prop}}>
    <ng-template  let-column="col" ngx-datatable-header-template>
       {{col.name}}
    </ng-template>
  </ngx-datatable-column>

</ngx-datatable>
...