ENHANCEMENT SSF-168 moved print and csv export buttons to the top of the grid

This commit is contained in:
Felipe Skroski 2012-04-04 14:08:19 +12:00
parent 4ffef20b09
commit 7740bb326a
3 changed files with 5 additions and 5 deletions

View File

@ -115,7 +115,7 @@ abstract class ModelAdmin extends LeftAndMain {
function getEditForm($id = null) { function getEditForm($id = null) {
$list = $this->getList(); $list = $this->getList();
$exportButton = new GridFieldExportButton(); $exportButton = new GridFieldExportButton('before');
$exportButton->setExportColumns($this->getExportFields()); $exportButton->setExportColumns($this->getExportFields());
$listField = Object::create('GridField', $listField = Object::create('GridField',
$this->modelClass, $this->modelClass,
@ -124,7 +124,7 @@ abstract class ModelAdmin extends LeftAndMain {
$fieldConfig = GridFieldConfig_RecordEditor::create($this->stat('page_length')) $fieldConfig = GridFieldConfig_RecordEditor::create($this->stat('page_length'))
->addComponent($exportButton) ->addComponent($exportButton)
->removeComponentsByType('GridFieldFilterHeader') ->removeComponentsByType('GridFieldFilterHeader')
->addComponents(new GridFieldPrintButton()) ->addComponents(new GridFieldPrintButton('before'))
); );
// Validation // Validation

View File

@ -52,7 +52,7 @@ class GridFieldPrintButton implements GridField_HTMLProvider, GridField_ActionPr
$button->addExtraClass('gridfield-button-print'); $button->addExtraClass('gridfield-button-print');
//$button->addExtraClass('no-ajax'); //$button->addExtraClass('no-ajax');
return array( return array(
$this->targetFragment => '<p class="grid-print-button">' . $button->Field() . '</p>', $this->targetFragment => '<p class="grid-print-button">' . $button->Field() . '</p>',
); );
} }

View File

@ -96,8 +96,8 @@ class Group extends DataObject {
if($this->ID) { if($this->ID) {
$config = new GridFieldConfig_RelationEditor(); $config = new GridFieldConfig_RelationEditor();
$config->addComponents(new GridFieldExportButton()); $config->addComponents(new GridFieldExportButton('before'));
$config->addComponents(new GridFieldPrintButton()); $config->addComponents(new GridFieldPrintButton('before'));
$config->getComponentByType('GridFieldAddExistingAutocompleter') $config->getComponentByType('GridFieldAddExistingAutocompleter')
->setResultsFormat('$Title ($Email)')->setSearchFields(array('FirstName', 'Surname', 'Email')); ->setResultsFormat('$Title ($Email)')->setSearchFields(array('FirstName', 'Surname', 'Email'));
$config->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator()); $config->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());