6
I have an HTML table that brings information from the database.
I wonder if there is any way to sort from A to Z and vice versa this data by clicking on the column name in the table?
These data are not fixed, they are dynamic.
Table:
<table>
<thead>
<tr>
<th>ST</th>
<th>BITRUCK</th>
<th>Motorista</th>
<th>Data Saída</th>
<th>Origem</th>
</tr>
</thead>
<tbody>
<?php foreach ($controller->Lista($objProg) as $objProg) { ?>
<tr>
<td>
<?php echo $objProg->getplaca(); ?></td>
<td>
<?php echo $objProg->getmot(); ?></td>
<td>
<?php echo $objProg->getorig(); ?></td>
<td>
<?php echo $objProg->getdest(); ?></td>
<td>
<?php echo $objProg->getmal(); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
You wanted an order in the column?
– Marconi
Yes, consequently ordering the others.
– KevinF
@Kevin. F, the information of the question, is not sufficient for an answer to your problem, could insert how this data is in your HTML, and how it sends from the database, if you use some framework, etc. The more information put the better we will be able to help :)
– David
@Kevin. F posted an answer.
– Marconi
@Marconi Okay, that was just gonna test it here.
– KevinF