21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 430 Views |
-
SS3 Gridfield buttons-before-left fragment missing

28 May 2012 at 2:59pm
Hi there, I've been playing around with GridField in SS3 and found a problem I'm not sure how to address.
I have the following model : 'Page' -- has_one --> 'Block' --has_many--> 'Contents'
I can successfully add a gridfield to manage the 'Page' -- has_one --> 'Block' relationship but as soon as I add the second 'Block' --has_many--> 'Contents' Relationship I get this error:
Error at \framework\forms\gridfield\GridField.php line 291: Uncaught LogicException: GridField HTML fragment 'buttons-before-left' was given content, but not defined. Perhaps there is a supporting GridField component you need to add?
Now I can get around that error by adding a $DefineFragment(buttons-before-left) somewhere in one of the GridField templates Eg \framework\templates\Includes\GridFieldToolbarHeader.ss It seesm to be adding the 'autocompleter' section.
Then it works well.... but this is obviously a slightly hacky way to do things - is there a better one? Have I just missed the correct procedure?
cheers
b
-
Re: SS3 Gridfield buttons-before-left fragment missing

18 July 2012 at 3:50am
b
Sorry not an answer, but I do have a question.. you say that you have a working has_one relation managed via GridField. Would you mind sharing that code as I am struggling to find references to this setup anywhere, its all 1-many and many-many.
Many thanks
Jason -
Re: SS3 Gridfield buttons-before-left fragment missing

18 July 2012 at 10:34am
sure thing:
NB I belive the previous problem has been addressed since I posted last!but a has one i've mostly managed with a dropdown field (I can't recall my original setup unfortunately) but if you really wanted i guess you could use something like this:
untested so mileage may vary...class SideBar extends DataObject {
static $db = array(
'Type' => 'Enum("SideItem,EducationSearchWidget,GoogleMapWidget","SideItem")',
'Title' => 'Varchar'
);
static $has_one =array(
'Style' => 'Style'
);function getCMSFields() {
parent::getCMSFields();$fields = new FieldList(
new TextField('Title'));
$sc = Style::get()->filter(array("ID" => "Style.ID"));
$GridField = new GridField("Style", "Styles on this page", $sc, new GridFieldConfig_RelationEditor());
$fields->push($GridField);return $fields;
}
}
| 430 Views | ||
|
Page:
1
|
Go to Top |


