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


Reply


13 Posts   2660 Views

Avatar
UndefinedOffset

Community Member, 27 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, 34 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, 27 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, 27 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, 34 Posts

22 December 2012 at 3:47am

Hi,

I put an issue on github.

Thanks for all the work.

Guy