Hi all, I've been looking at the options availible to the admin for data fields. They're all pretty neat! :)
My mind is having a field day at the posiblitys the dataobject relationships are opening up.
Unfornately for me and everyone else I'm still quite novice. And my head is still coming to terms with it all. Any advice on setting up a comlextablefield for the current page? I'd like to associate a complex table and all it's entrys to only one page.
I've been reading and playing all day, and while having a lot of fun I am getting a little brain dead. With out really thinking I tried the following
class Project extends Page {
static $db = array(
'FirstName' => 'Text',
'Lastname' => 'Text',
'Nationality' => 'Text'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$tablefield = new ComplexTableField(
$this,
'MyStudent',
'Project',
array(
'FirstName' => 'First Name',
'Lastname' => 'Family Name',
'Nationality' => 'Nationality'
),
'getCMSFields_forPopup'
);
$tablefield->setParentClass(false);
$fields->addFieldToTab( 'Root.Content.Student', $tablefield );
return $fields;
}
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'FirstName', 'First Name' ) );
$fields->push( new TextField( 'Lastname' ) );
$fields->push( new TextField( 'Nationality' ) );
return $fields;
}
}
Don't laugh, I actually thought it might work....... Then realised db array will only have one field for each page in the databased, then further realised using Project as the source class would cause issues when saving which it did :)
I cant fathom how to get it working.... any pointers or links to the answers for all questions would be amazing.