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

GridFieldConfig_RelationEditor select by checkbox?


Go to End


6 Posts   2102 Views

Avatar
Fraser

Community Member, 48 Posts

14 August 2012 at 3:51pm

Edited: 14/08/2012 3:51pm

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

Avatar
lze

Community Member, 1 Post

15 August 2012 at 6:44am

Edited: 15/08/2012 7:00am

+1 to the question.

I want to solve this problem as well.

Avatar
Fraser

Community Member, 48 Posts

15 August 2012 at 10:55am

Edited: 15/08/2012 11:36am

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.

Avatar
DesignerX.com.au

Community Member, 107 Posts

4 September 2012 at 4:14pm

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

Avatar
svandragt

Community Member, 44 Posts

29 January 2013 at 5:02am

Avatar
Digital Punk

Community Member, 51 Posts

8 April 2013 at 3:18am

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