Hey guys so I am trying to use the jQuery plugin table sorter (tablesorter.com). I made a test page based off their demo and it worked no problem. However now I am trying to imp
Put your <tbody>
outside the for loops.
...
</thead>
<tbody>
<?foreach ($organizations as $organizationObj) {
foreach ($organizationObj as $curOrg) {
if($curOrg->get("name") == "System"){
//Hide the System organization from vCloud
continue;
}?>
<tr>
<td><?=$curOrg->get("name");?></td>
<td><?=$curOrg->get("description")===""?"None":$curOrg->get("description")?></td>
<td><?=$curOrg->get("systemName")?></td>
<td><?=$status[$curOrg->get('status')];?></td>
<td id="client<?=$curOrg->get('id');?>">
<?if($curOrg->get("clientId")==0){ ?>
<button class="btn btn-tiny btn-reverse associate" data-uid="<?=$curOrg->get('id');?>"><?=$languageDB->berkGet("action_associate");?></button>
<?} else{
$client=new client($curOrg->get("clientId"));?>
<?=$client->get("companyName");?>
<?}?>
</td>
<td><a href="/organizationDetails.php?id=<?=$curOrg->get('id');?>" class="btn btn-tiny"><i class="fa fa-info-circle"></i></a>
<?if($curOrg->get("clientId")>0){ ?>
<button class="btn btn-danger btn-tiny" id="remove" data-uid="<?=$curOrg->get('id');?>" data-name="<?=$curOrg->get('name');?>"><i class="fa fa-trash"></i> </button>
<?}?>
</tr>
<?}
}?>
</tbody>
</table>
Use Jquery datatables
in your case:
$(document).ready(function()
{
$("#orgTable").DataTable();
}
);
https://www.datatables.net/examples/basic_init/zero_configuration.html
UPDATE:
If you dont want to change ur tablesorter or use any other jQuery plugin for table sorting,check ur <script>
tags
use :
<script type="text/javascript"></script>
instead of :
<script type="text/javascript"/>
That's because the script tag cannot be a self closing tag
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#orgTable").tablesorter();
}
);
</script>