7935 Posts in 1536 Topics by 943 members
|Go to End|
27 May 2012 at 8:36pm Last edited: 27 May 2012 8:37pm
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?
4 August 2012 at 12:06am Last edited: 4 August 2012 12:12am
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).
1 October 2012 at 11:51pm
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.
|Go to Top|