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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Drag and drop order of Gridfield elements


Go to End


14 Posts   6697 Views

Avatar
UndefinedOffset

Community Member, 30 Posts

11 July 2012 at 2:45am

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');
}

Avatar
Guy Van Bael

Community Member, 61 Posts

22 December 2012 at 12:13am

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?

Thnx
guy

Avatar
UndefinedOffset

Community Member, 30 Posts

22 December 2012 at 2:18am

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.

Avatar
UndefinedOffset

Community Member, 30 Posts

22 December 2012 at 2:57am

Also if you would be so kind could you post a bug report to https://github.com/UndefinedOffset/SortableGridField/issues 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.

Avatar
Guy Van Bael

Community Member, 61 Posts

22 December 2012 at 3:47am

Hi,

I put an issue on github.

Thanks for all the work.

Guy

Avatar
neilcreagh

Community Member, 136 Posts

21 January 2015 at 12:13am

Hey UndefinedOffset, on the off chance that you're subscribed to this thread, could you take a look at the issue I'm having setting up SortableGridField on a many_many RelationEditor?
http://www.silverstripe.org/community/forums/all-other-modules/show/98597

Go to Top