valor-software / ng2-table

Simple table extension with sorting, filtering, paging... for Angular2 apps
http://valor-software.github.io/ng2-table/
MIT License
553 stars 336 forks source link

how to change line color #599

Open rodrigodesp opened 6 years ago

rodrigodesp commented 6 years ago

I want to change the color of the line when the column contains a specific value, how do make it

ex.: Where Salary > 100.000 I want to put the green color to row

rodrigodesp commented 6 years ago

I would like to put the properties rows (?Array) - only list of the rows which should be displayed className (string|Array) - additional CSS classes that should be added to a row

breitling commented 4 years ago

Here is how I added table row color. I added an [ngClass]="{ 'selected': config.method(row) }" to the tr tag of the table body in ng2-table source files. I then added a method to my config object in my component where I used the ng-table component. This method tested the column that contained the value I wanted to test and returned true when the specific value was there.

And bing, bang, boom, the table had colored rows when the correct value was in the column.