I have an HTML table that brings information from the database.
I would like to know if there is any way to sort from A to Z and vice versa and vice versa by clicking on the name of the column in the table?
This data is not fixed, it is 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>