Forums

DB Multi Record Loader and sortable columns

momentis 13 Mar, 2012
I am using the following to display a list of database records, each with a link to a record edit form, in a Custom Code action within a DB Multi Record Loader action:

<table style="width:98%; margin-bottom:30px;">
<tr valign="bottom" style="border-bottom:2px solid #444444;">
<td style="width:20%;" align="left">Company Name</td>
<td style="width:10%;" align="left">First Name</td>
<td style="width:10%;" align="left">Last Name</td>
<td style="width:10%;" align="left">Account #</td>
<tr>
<?php
foreach($form->data['RegList'] as $detail):
?>
<td><a href="index.php?option=com_chronoforms&chronoform=program_registration_detail&token=<?php echo $detail['cf_id']; ?>" title="Click to Edit"><?php echo $detail['co_name']; ?></a></td>
<td><?php echo $detail['reg_fname']; ?></td>
<td><?php echo $detail['reg_lname']; ?></td>
<td><?php echo $detail['co_account']; ?></td>
</tr>
<?php
endforeach;
?>
</table>


This does exactly what I need. However, I would like to make the table sortable on the `co_name` field. I cannot use the "Order fields" item on the Data Displayer tab, because I am not using the standard data displayer. Is there any way I can do this using my existing setup? Or, is there a better way I can be doing this?
GreyHead 13 Mar, 2012
Hi Rick,

I think that Max suggested somewhere that adding an ORDER BY clause after your WHERE clause might work. I also got ordering to work using the Order Fields box on the Data Displayer tab and turning Enable Pagination On - but some other users couldn't get this to work.

Bob
momentis 14 Mar, 2012
Adding the "ORDER BY" worked! Thanks!!!

Is this kind of function something that I should look at ChronoConnectivity to accomplish? Ideally, I would like to be able to generate table views like this, fully sortable by multiple columns, and then generate links to different CF forms from within that data.
GreyHead 14 Mar, 2012
Hi Rick,

Yes, ChronoConnectivity is the list, filter and link tool. It may need to go another release or two before CCv4 is fully functional though :-(

Bob
momentis 14 Mar, 2012
Cool! I will have need of it, so I might as well start learning what I can now.
This topic is locked and no more replies can be posted.