Hi,
I have problems with the setdisplayfields method in SilverStripe 3.0.0. It says that the method 'setdisplayfields' does not exist on 'GridField'. Is there anybody else that has experiend similar problems? I post my code here and hope some of you have an idea of what I'm doing wrong here...
class HomePage extends Page {
public static $db = array(
);
public static $has_many = array(
'HomePageSlides' => 'HomePageSlide' // link the slide items
);
function getCMSFields() {
$fields = parent::getCMSFields();
$gridfieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(15),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
);
$gridfield = new GridField("HomePageSlides", "Slides", $this->HomePageSlides(), $gridfieldConfig);
$gridfield->setDisplayFields(array(
'ID' => 'ID'
));
$fields->addFieldToTab('Root.Slides', $gridfield);
return $fields;
}
}
class HomePage_Controller extends Page_Controller {
public static $allowed_actions = array (
);
public function init() {
parent::init();
}
}