Dynamic List Order

5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 19, 2010   (RSS)

Re: [Perchpole] Dynamic List Order

By Toledoh - March 19, 2010

If I have a table - I use jQuery to sort and filter...

http://www.forrest.id.au/nutsnbolts/tables.php as an example.
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Dynamic List Order

By Perchpole - March 19, 2010

Hi, Toledoh -

Thanks for your suggestion but it doesn't really fit my requirements. I'm looking for something that will change the order of a list - possibly spanning several pages.

I was hoping we might be able to do it with a search query - something like...

?section=cars&orderBy=price

...or some such thing!

:0)

Perchpole

Re: [Perchpole] Dynamic List Order

By Chris - March 19, 2010

Hi Perchpole,

Yes, you can feed a form element into your orderBy for getRecords() like this:

$orderBy = 'default order by';
if (@$_REQUEST['orderBy']) {
$orderBy = $_REQUEST['orderBy'];
}
list($record, ) = getRecords(array(
'tableName' => 'cars',
'orderBy' => mysql_escape($orderBy),
));


I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Dynamic List Order

By Perchpole - March 19, 2010

Chris -

Yet again you never cease to amaze me!

Ossum.

:0)

Perch