Hey guys,
I have a little problem. I have a DataObject "Job" with a "title" and a gridfield.
What I wanna do is, to set the title of the DataObject in the header of the gridfield (in the backend), so that the title is shown up in die printview if I click the printbutton.
class Job extends DataObject{
static $db = array( 'Title' => 'Varchar(255)' );
static $has_many = array(
'JobWorktimes' => 'JobWorktime'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
/* Worktimes */
$config = GridFieldConfig_RelationEditor::create();
$config->addComponent(new GridFieldPrintButton());
$WorkField = new GridField(
'JobWorktimes',
'JobWorktime',
$this->JobWorktimes(),
$config
);
$fields->addFieldToTab('Root.Main', $WorkField);
return $fields;
}
}
Now the gridfield title is named normally "Worktime", but I wanna to set the title of the dataobject.
I´ve tried something like this:
$config->addComponent(new GridFieldToolbarHeader($this->title));
But any string I´ve set in there, doesn´t appear and it creates a "double" headerbar.
Is it possible to change the origanal name ("Worktime") in the header of the gridfield?