21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 986 Views |
-
GridFieldConfig_RelationEditor

11 May 2012 at 10:16pm Last edited: 11 May 2012 10:17pm
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();
$gridFieldConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields('Title');
$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
Joel
-
Re: GridFieldConfig_RelationEditor

11 May 2012 at 10:50pm
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:
$gridFieldConfig->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('Title'));
-
Re: GridFieldConfig_RelationEditor

5 June 2012 at 10:06pm
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
-
Re: GridFieldConfig_RelationEditor

31 July 2012 at 11:38am Last edited: 31 July 2012 11:41am
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?!
greetz,
Florian -
Re: GridFieldConfig_RelationEditor

2 August 2012 at 2:39am Last edited: 2 August 2012 7:54am
Hello,
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?
Thanks!
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 2586Is there any solution to this problem? What am I doing wrong?
| 986 Views | ||
|
Page:
1
|
Go to Top |




