Question

I've been looking around for a solution to this thing but I haven't found anything similar to what I want.

I've got a table filled with data from a database, and I want to change the background colour of a specific row depending on the class I'm loading in each row.

I have to display some data but as the fields to be displayed are quite a lot, I don't have more space to show a status field, so I would like to show the row in red if the status is inactive, and the rest of the rows in the normal color of the blue stylesheet.

Is there a way to do that through tablesorter? I'm open to suggestions, as I'm not sure of how I want to do it.

Thank you all in advance,

Victor

Was it helpful?

Solution

<style>
      table.even, tr.active td
       {
         background-color:#00F; //BLUE IF ACTIVE
         height:40px;
       }

       table.even, tr.inactive td
       {
         background-color: #F00;//RED IF INACTIVE
         height:40px;
       }
</style>


<table>
    <tr class= (put condition which returns true if active otherwise false)?   "active" : "inactive">


    </tr>
<table>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top