Jump to:

22976 Posts in 11667 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Drag and drop order of Gridfield elements

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

Page: 1 2
Go to End
Author Topic: 2198 Views
  • UndefinedOffset
    Avatar
    Community Member
    27 Posts

    Re: Drag and drop order of Gridfield elements Link to this post

    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
    Avatar
    Community Member
    28 Posts

    Re: Drag and drop order of Gridfield elements Link to this post

    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

  • UndefinedOffset
    Avatar
    Community Member
    27 Posts

    Re: Drag and drop order of Gridfield elements Link to this post

    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.

  • UndefinedOffset
    Avatar
    Community Member
    27 Posts

    Re: Drag and drop order of Gridfield elements Link to this post

    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.

  • Guy Van Bael
    Avatar
    Community Member
    28 Posts

    Re: Drag and drop order of Gridfield elements Link to this post

    Hi,

    I put an issue on github.

    Thanks for all the work.

    Guy

    2198 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.