I have a problem where I want to add index numbering 1.2.3.4..etc at my table but the table content have @if($t1,t2,t3,..etc > 0) condition on it, if I hard code the number in view, if it meets $t1,t2,t3,..etc < 0, it will skip the index number
<thead>
<tr>
<th>No.</th>
<th>Subject name</th>
<th>No. of students</th>
</tr>
</thead>
<tbody>
@if($t1>0)
<tr class="gradeX">
<td>1</td>
<td><a href="" target="_blank">Technology & Information System</td>
<td style="text-align:center"></td>
</tr>
@endif
@if($t2>0)
<tr class="gradeX">
<td>2</td>
<td><a href="" target="_blank">Discrete Structure</td>
<td style="text-align:center"></td>
</tr>
@endif
The output should show the numbering without skipping any number even it skip the condition.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire