Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Column sorting bug?


Reply

3 Posts   894 Views

Avatar
Praxis Interactive

27 May 2012 at 8:36pm (Last edited: 27 May 2012 8:37pm), Community Member, 2 Posts

Hey all,

Was scratching my head for the past hour trying to figure out why column sorting wasn't working in a DOM field in my admin (2.4.7). After looking through the source, it seems that DOM is using the $_REQUEST key 'sort_dir' ($_REQUEST['ctf'][$this->Name()]['sort_dir']) to pass the direction, but the superclass TableListField requires the key 'dir' to be used, hence sorting does not work. Changing all references from the 'sort_dir' key to 'dir' in DataObjectManager.php fixed it for me. Is this a bug or have I missed something?

Thanks,

Colin.

Avatar
HARVS1789UK

4 August 2012 at 12:06am (Last edited: 4 August 2012 12:12am), Community Member, 21 Posts

Colin,

I was suffering a problem where I could sort my columns in ASC order (each time I clicked a different table header) but could not sort columns in DESC order.

EDIT: After thinking about it this will be because if you pass an ORDER BY clause in a SQL statement which does not specify an order then it defaults to ASC (so neither ASC or DESC sorting were actually working for me as intended just by SQL's default option)

The fix you suggested worked well for me as well! Thank you.

For anyone else with this issue I did a find & replace all 'sort_dir' with 'dir' in /dataobject_manager/code/DataObjectManager.php

(There were 15 instances in my file).

Cheers,

HARVS1789UK

Avatar
Stef87

1 October 2012 at 11:51pm Community Member, 66 Posts

Hi guys,

Excellent fix. You saved me hours of tearing my hair out. I was wondering is there any negative effects from doing this? I can't see any which is great so far.

Thanks