ng2-table icon indicating copy to clipboard operation
ng2-table copied to clipboard

Change a single cell color

Open hgarc014 opened this issue 8 years ago • 1 comments

How do I change the color of a single cell based on a condition?

in an ordinary table I could do something like:

<table>
  <tr>
    <td [ngStyle]="{'background-color': cell.color}>
this cell's color is {{cell.color}}
    </td>
    <td>
      // other columns keep the default color
    </td>
  </tr>
</table>

I do not see a way to achieve this through ng2-table.

hgarc014 avatar Apr 05 '17 17:04 hgarc014

@hgarc014 Is it possible to iterate over rows in html? I know for the fact that if you use [rows]="rows" then it will be populated but If i want to iterate over then how is it possible? The following I am doing but it doesn't work

<ng-table [config]="config" [columns]="columns">

      	<tr *ngFor="let row of rows">
      		<td>1</td>
      		<td>{{ row.eid }}</td>
      		<td>{{ row.rankValue }}</td>
      		<td>{{ row.reason.similarilty }}</td>
      	</tr>
    </ng-table>  

Sam2243 avatar Jan 19 '18 00:01 Sam2243