I try to use the ComplexTableField in a LeftAndMain to allow the user to edit all entries of one type (dataobject)
VIPAdmin.php
<?
class VIPAdmin extends LeftAndMain {
static $url_segment = "vip";
static $url_rule = '$Action';
static $menu_title = "VIP Editor";
static $menu_property = 60;
function getEditor() {
$editor = new ComplexTableField(
$this,
'VIPs',
'VIP',
array('Name','Spruch'),
new FieldSet(
new TextField('Name'),
new TextareaField('Spruch')
)
);
$editor->setParentClass(false);
return new FieldSet($editor);
}
function VIPs() {
return DataObject::get('VIP');
}
}
?>
VIP.php
<?
class VIP extends DataObject {
static $db = array(
"Name" => "Varchar(50)",
"Spruch" => "Text"
);
static $has_one = array(
"Bild" => "Image"
);
}
?>
VIPAdmin_right.ss
<h1>VIP Editor</h1>
<% if Editor %>
$Editor
<% else %>
Kein Editor
<% end_if %>
if i replace the "return new FieldSet($editor);" with a "return "Hello World!"; " it works. however with the $editor. it shows blank unless the h1-tag
Thx for your help.
ps.: sry for my broken english. im from germany