samedi 21 mars 2020

Laravel table cell color with cell value

This is my blade loop.

@for ($coun=0;$coun< $count_2; $coun++)
<table id="table2" border="1" style="display: inline-block;clear: both;">
        <tbody>
          <tr><td><?php print_r( $array_mem['id'][$coun]); ?></td></tr>
          <tr><td><?php print_r( $array_mem['Name'][$coun]); ?></td></tr>
          <tr><td><?php print_r( $array_mem['Mark'][$coun]); ?></td></tr>
          <tr><td><?php print_r( $array_mem['Sub_1'][$coun]); ?></td></tr>
          <tr><td><?php print_r( $array_mem['Sub_2'][$coun]); ?></td></tr>
          <tr><td><?php print_r( $array_mem['Sub_3'][$coun]); ?></td></tr>
        </tbody>
</table> @endfor

I Have set of conditions to check the values in each column. and also change the cell colour depends.

+-------------------+-------------+
| Condition         | Cell Colour |
+-------------------+-------------+
| If Id < 10        | Red         |
+-------------------+-------------+
| If Id>10 && Id<20 | Green       |
+-------------------+-------------+
| If Mark <20       | Red         |
+-------------------+-------------+
| If Mark >20       | Green       |
+-------------------+-------------+
| If Sub_1 < 20     | Red         |
+-------------------+-------------+

Is there any way to check and make the cell in specific colour.

Am looking something except using if else condition, that means using function or this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire