Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » GridFieldConfig_RelationEditor select by checkbox?

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: 863 Views
  • Fraser
    Avatar
    Community Member
    46 Posts

    GridFieldConfig_RelationEditor select by checkbox? Link to this post

    I've created a number of Gridfields with GridFieldConfig_RelationEditor for some many_many relationships.

    The way this works is not ideal as the user must know what has already been added to be able to search for it.

    Is there a way to achieve similar to what we used be able to do with the Dataobjectmanager. ie displaying every item and allow them to select the ones they want with a checkbox?

    Activity.php

    <?php
    class Activity extends DataObject{
       public static $db = array(
          'Title' => 'Varchar(255)',
          'Summary' => 'Text'
       );
       static $belongs_many_many = array(
          'TourPages' => 'TourPage'
       );
       public static $summary_fields = array(
          'Title' => 'Title'
       );
       public function getCMSFields_forPopup() {
           return new FieldList(
              new TextField('Title', 'Title'),
              new TextareaField('Summary', 'Brief Summary')
           );
       }
    }

    TourPage.php

    ....
    static $many_many = array(
       'Activities' => 'Activity'
    );
    .....

    $gridField = new GridField("Activities", "Activities", $this->Activities(), new GridFieldConfig_RelationEditor);
    $fields->addFieldToTab("Root.Activities", $gridField);

  • lze
    Avatar
    Community Member
    1 Post

    Re: GridFieldConfig_RelationEditor select by checkbox? Link to this post

    +1 to the question.

    I want to solve this problem as well.

  • Fraser
    Avatar
    Community Member
    46 Posts

    Re: GridFieldConfig_RelationEditor select by checkbox? Link to this post

    This is just one of a few issues I am having with GridFields. The documentation is hugely lacking at the moment and it seems quite buggy.

    When you add a new item or edit an existing one, why can you not return directly to the GridField? It is an annoyance for the user to have to come all the way out and go back in each time they want to add or edit something?

    Randomly, when a new item is added, or an existing one edited and you click in the crumbtrail to get back to the page, 2 throbbers appear followed by a blank grey screen, requiring a refresh before any further action can be taken.

    We are also experiencing random "Request-URI too large" errors when searching for items in the RelationEditor.

    It's a pretty horrible experience handing this over to clients in this state.

    I miss DataObjectManager.

  • DesignerX.com.au
    Avatar
    Community Member
    107 Posts

    Re: GridFieldConfig_RelationEditor select by checkbox? Link to this post

    A good question, I been trying to get the answer for it too ... I will have a look at blogs & IRC to see if anyone can help .
    IF you have the answer already, pleas please post here
    Thanks

  • svandragt
    Avatar
    Community Member
    44 Posts
  • Digital-Punk.co.uk
    Avatar
    Community Member
    51 Posts

    Re: GridFieldConfig_RelationEditor select by checkbox? Link to this post

    Hi, anyone found a solution how to fix "Request-URI Too Large" issue?

    863 Views
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.