as far i noticed summary_fields will display fields in grid view.
in grid view i only want to show the title- field and the display- field.
the question is about the print button and the print- view with additional fields.
meanwhile with a lot of trials and errors this is working:
$gridField->getConfig()->removeComponentsByType('GridFieldPrintButton');
$gridField->getConfig()->addComponent(new GridFieldPrintButton('before', array(
'Title' => 'Titel',
'SubTitle' => 'SubTitel',
'Display' => 'Display',
'EventContent' => 'SeminarText',
'EnrolmentText' => 'Text bei Anmeldung'
)));
so i had to remove the standard- button first.
but i couldn't get this to work :
$gridField->getConfig()->GridFieldPrintButton->setPrintColumns(array(
'Title' => 'Titel',
'SubTitle' => 'SubTitel',
'Display' => 'Display',
'EventContent' => 'SeminarText',
'EnrolmentText' => 'Text bei Anmeldung'
));
anyway here comes the next question:
instead of the booleans value 0/1 i want to show icons:
class Event extends DataObject {
.....
public static $summary_fields = array(
'Title' => 'Titel',
'CheckDisplay' => 'Display'
);
function CheckDisplay(){
return $this->Display == '1' ? DBField::create_field('HTMLVarchar', '<img src="'.basename(dirname(dirname(__FILE__))).'/img/yes-content.png"/>') : DBField::create_field('HTMLVarchar', '<img src="'.basename(dirname(dirname(__FILE__))).'/img/no-content.png"/>');
}
this is working and its displaying the icons in grid-view correctly in the page- view as also in model admin.
but when it comes to print out of modeladmin the path for the icons is not correct.
thanks.timo