I have a list (ordered by id
):
MySQL:
ORDER BY id ASC
Table:
id name value status
---------------------------------------------------
1 david 56 0
2 jack 67 1
3 alex 23 0
4 leah 98 1
----------------------------------------------------
..........
Question:
I want to display the rows with status == 1` on the top (I wont use MySQL), How Could I do that with jQuery.
The result should be:
id name value status
---------------------------------------------------
2 jack 67 1
4 leah 98 1
1 david 56 0
3 alex 23 0
----------------------------------------------------
..........
I tried:
HTML + PHP:
<table>
<?php if($row->status == 1) { ?>
<tr class="order">
<?php } else { ?>
<tr>
<?php } ?>
<td> ...</td>
</tr>
</table>
jQuery:
$('table tr:first').before($('tr.order'));