i would like to change row color based on my condition. I am using Bootgrid js (http://www.jquery-bootgrid.com/Documentation)
Here is example:
This works on "normal" tables
<?php
if(condition = 1){
<tr class="red">
} else {
<tr>
}
?>
I have tried with template formater but it apply on whole table not on my condition
Does anybody know is this possible and how to do this? Thx
You can use it with 2 methods
1) shorted if statement like below
<tr <?PHP echo ($condition == 1 ? 'class="red"' : ''); ?>>
2) Normal if statement
<?php
if(condition == 1){
<tr class="red">
} else {
<tr>
}
?>
Another way
$a_json_row["status"] = 0; // success row
$a_json_row["status"] = 1; // info row
$a_json_row["status"] = 2; // warning row
$a_json_row["status"] = 3; // error row
the below js code extend the status mappings.
$("#grid").bootgrid({
statusMappings: {
4: "wrong"
}
});