Sorting Order by

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

I've set up the sorting for a CMSB section with "dragSortOrder, date DESC" in the Order By field. However, when I add a new record to this section, it always puts the new item at the bottom of the list. The only way for me to get it to the top is to drag it there.

Please can you tell me where I'm going wrong?

Thanks!
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [Dave] Sorting Order by

Hi, Dave.

It doesn't seem to be reflected on the live page: http://66.7.208.127/~harolda1/newsPhotos.php
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Sorting Order by

By Dave - February 4, 2010

Nigel,

Does the live page have a custom orderBy option in the viewer code?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Sorting Order by

Hi, Dave.

Do you have an example of what this looks like and where it should go in the code?

Cheers,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Sorting Order by

By Chris - February 5, 2010

Hi Nigel,

A custom orderBy options looks like this:

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'orderBy' => 'title',
));


If you have a line like that in your viewer code, it will override your section's default order. Simply remove that line and you'll get the same sort order as in the CMS Builder interface.

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

Re: [chris] Sorting Order by

Hi, Chris.

I tried the following, which does exactly what I need.

list($news_room_photo_galleryRecords, $news_room_photo_galleryMetaData) = getRecords(array(
'tableName' => 'news_room_photo_gallery',
'perPage' => '5',
'orderBy' => 'date DESC',
));


Many thanks for your help.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net