I used the jQuery datatable plugin in sort the table data. The sorting works fine if a column contains simple text. If I put any anchor tag condition on a text then the column sorting does not sort properly.
I displayed the values in following manner:
<td><?php if ($allAptArr[$d][27]['staffinactive'] == 1) { ?>
<?=ucwords(stripslashes($allAptArr[$d][5]['staff_name']));?>
<?php } else { ?>
<a href='#' onClick="redirectToStaff('<?=$allAptArr[$d][10]['staff_id']?>');">
<?=ucwords(stripslashes($allAptArr[$d][5]['staff_name']));?>
</a>
<?php } ?> </td>
with this code the column sorting fails.