Jump to:

23477 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » GridFieldConfig_RelationEditor

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
Go to End
Author Topic: 1808 Views
  • joelg
    Community Member
    129 Posts

    GridFieldConfig_RelationEditor Link to this post

    Hi there

    I'm having some fun with the gridfield in SS3 beta2. I can't really figure out how the many_many relations work with GridField. Here's my code:

    public static $many_many = array(

    "RightColumnBoxes" => 'RightColumnBox'



    $gridFieldConfig = GridFieldConfig_RelationEditor::create();


    $GridField = new GridField("RightColumnBoxes", "Context in right column:", $this->RightColumnBoxes(), $gridFieldConfig);

    $fields->addFieldToTab("Root.RightColumn", $GridField);

    There are no errors with this, but how can I attach these many many relations to my pages where the relation is defined? There are no check boxes in the gridfield, and the search field doesn't seem to return anything.

    Is it because this part of gridfield isn't finished?

    Many regards


  • joelg
    Community Member
    129 Posts

    Re: GridFieldConfig_RelationEditor Link to this post

    Ok, figured this one out...

    You have to create an array of strings of fieldnames to the setSearchFields method...

    It would have been nice though with a possibility to just view all records and select between these (how would I od that?).

    Anyway, it works now. The code should look like this:


  • Bolixe
    Community Member
    17 Posts

    Re: GridFieldConfig_RelationEditor Link to this post

    Hi Joelg!

    I am also having some fun with the beta 3. You said there is not checkboxes for the dataobjects related with other dataobjects which are in the tabs. Do you know some way to handle the relationships in the way you could do with the complextablefield ????

    I would like to have something like this for a project I want to upgrade.

    Thanks, greetings

  • spierala
    Community Member
    80 Posts

    Re: GridFieldConfig_RelationEditor Link to this post

    Hello all,
    I also try to figure out how to setup the GridField for a Many-to-many relation. I can´t see checkboxes. You can browse existing DataObjects within a searchfield... and then say "Link Existing". is that the way to go?!

  • hallecsyz
    Community Member
    5 Posts

    Re: GridFieldConfig_RelationEditor Link to this post


    I'm having the same problem as spierala. The DataObjects list only allows me to add, edit or delete items. But how can I edit the relation?


    Edit: I just found that the right way is through the filter field, I didn't realize that my problem was that the filter wasn't working. When I start typing I get a javascript error.

    SyntaxError: JSON.parse: unexpected character.
    In assets/_combinedfiles/lib.js at line 2586

    Is there any solution to this problem? What am I doing wrong?

Page: 1
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.