7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » TreeDropdownField in DataObjectManager
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1131 Views |
-
TreeDropdownField in DataObjectManager

23 October 2010 at 2:42am
Hello,
I'm trying to get a TreeDropdownField in a DataObjectManager but can't seem to make it work. Here is my code
HomPage.php//SideLinksDOM
$SideLinksManager = new DataObjectManager(
$this,
'SideLinks',
'SideLink',
array(
'Label' => 'Label'
), 'getCMSFields_forPopup'
);
$SideLinksManager->setParentClass('HomePage');
$fields->addFieldToTab('Root.Content.SideLinks', $SideLinksManager);
return $fields;SideLink.php
class SideLink extends DataObject{
static $db = array(
'Label' => 'Varchar(150)'
);
static $has_one = array(
'Parent' => 'SiteTree',
'Target' => 'SiteTree',
'Image' => 'Image',
'PageLink' => 'SiteTree'
);
public function getCMSFields(){
$treeDropDownField = new TreeDropdownField("PageLinkID", "Choose a page to link to", "SiteTree");
return new FieldSet(
new TextField('Label', 'Label'),
$treeDropDownField
);
}
}The label field shows no problem but the drop down does not show up. If I change "PageLinkID" to "PageLink' it will show up but will not expand to show any fields.
What am I doing wrong? thanks!
-
Re: TreeDropdownField in DataObjectManager

23 October 2010 at 3:07am
You need to use SimpleTreeDropdownField.
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: TreeDropdownField in DataObjectManager

23 October 2010 at 3:12am
great, thanks.
And I see in the DataObjectManager docs SimpleTreeDropdownField is listed there. arg, when I get frustrated I forget to check the most obvious places.
Thanks again.
| 1131 Views | ||
|
Page:
1
|
Go to Top |

