5099 Posts in 1519 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 954 Views |
-
ComplexTableField always has only ID-Column

15 June 2009 at 5:47pm Last edited: 15 June 2009 5:52pm
Hello from Germany,
in the moment i make my first experiences with Silverstripe, while rebuilding my own website before i use it for customers. in the moment i still have an problem with the complextabelfield, again and again. Here is a simple example, for testing issues, that wont work:
First the Data:
<?php
class Frage extends DataObject {
static $db = array(
'Frage' => 'Text',
'Antwort' => 'Text',
);static $has_one = array(
'Seite' => 'FAQ',
);static $singular_name ="Frage";
static $plural_name ="Fragen";function getCMSFields() {
$fields = new FieldSet(
new TextField('Frage','Frage'),
new TextAreaField('Antwort','Antwort')
);return $fields;
}}
?>
And now the Page:
<?phpclass FAQ extends Page {
public static $db = array(
);
public static $has_many = array(
'Fragen' => 'Frage'
);function getCMSFields() {
$fields = parent::getCMSFields();$newTable = new ComplexTableField(
$this,
'Fragen',
'Frage',
null,
null,
"Frage.SeiteID = {$this->ID}"
);
$fields->addFieldToTab("Root.Content.Fragen",$newTable);return $fields;
}}
class FAQ_Controller extends Page_Controller {
public function init() {
parent::init();
}}
?>
This works, but my Table has only the Column ID. I tried to modify that by setting the third parameter of the complextablefield-Constructor with an array instead of null, but this causes an error, when adminarea should show the page for edit.Which stupid error do I made??? I have this problem again and again. Thanks you a lot for a helping hint!
Heiner
-
Re: ComplexTableField always has only ID-Column

16 June 2009 at 5:30pm
3rd parameter should be an array. You must have had a typo with it.
| 954 Views | ||
|
Page:
1
|
Go to Top |


