7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Column sorting bug?
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 559 Views |
-
Column sorting bug?

27 May 2012 at 8:36pm Last edited: 27 May 2012 8:37pm
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.
-
Re: Column sorting bug?

4 August 2012 at 12:06am Last edited: 4 August 2012 12:12am
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
-
Re: Column sorting bug?

1 October 2012 at 11:51pm
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
| 559 Views | ||
|
Page:
1
|
Go to Top |



