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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Drag and drop order of Gridfield elements


13 Posts   2638 Views


11 July 2012 at 2:45am Community Member, 27 Posts

It sounds to me like it's not getting a ManyManyList instance but something else, which would cause the query you mentioned to not fire. Your work around shouldn't be needed at all if a ManyManyList is received by GridFieldSortableRows. Your code looks good to me, so I'm not sure why it wouldn't be a ManyManyList.

Try adding print get_class($productList);exit; bellow your $productList definition after you call sort on it. What does that produce? Also make sure that you do not have a has_many relationship named the same in that class or any parent classes. Otherwise you may get a HasManyList instead.

You could also try using a custom getter like the following, which should guarantee you get a ManyManyList back:

public function getMyManyManyRelationship() {
return $this->getManyManyComponents('MyManyManyRelationship')->sort('SortColumn');

Guy Van Bael

22 December 2012 at 12:13am Community Member, 34 Posts

This seems to be broken in SS3.1.0 Beta 1. It worked in 3.0.3 though.
Any chance of update for this module or is the functionality in the core now?
If so, anyone knows how to use it?



22 December 2012 at 2:18am Community Member, 27 Posts

I'm planning to update SortableGridField to work with 3.1 once 3.1 is stable. Also I've heard the issue is a bug in the core? Not sure someone mentioned it on the irc the other day. To be honest I haven't really tested any code in 3.1 yet. As for getting it merged into the core I haven't pressed the issue with Ingo or any of the rest of the SS team since I was originally writing it.


22 December 2012 at 2:57am Community Member, 27 Posts

Also if you would be so kind could you post a bug report to preferably with the error (and stack trace if possible) as well as a screenshot (also if possible).

Will save me some time when I go to address the issue if I can.

Guy Van Bael

22 December 2012 at 3:47am Community Member, 34 Posts


I put an issue on github.

Thanks for all the work.