Created
May 27, 2015 18:40
-
-
Save bueckl/5b6e5a3d8c9cfdd2ac9f to your computer and use it in GitHub Desktop.
SS3, Silverstripe, GridField config Field #Casting #Formating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$gridField->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields(array( | |
'Created' => 'Erstellt', | |
'Code' => 'Code', | |
'Value' => 'Wert', | |
'Origin' => 'Gutscheinart', | |
'Invoice.Buyer.FirstName' => 'Vorname', | |
'Invoice.Buyer.Surname' => 'Nachname', | |
'inUse' => 'Benutzt' | |
)); | |
$gridField->getConfig()->getComponentByType('GridFieldDataColumns')->setFieldFormatting(array( | |
'Created' => function($val, $obj) { return $obj->dbObject('Created')->Nice(); } | |
)); | |
.... | |
or ... | |
$gridField->getConfig()->getComponentByType('GridFieldDataColumns')->setFieldFormatting(array( | |
'Created' => function($val, $obj) { return $obj->dbObject('Created')->Format('d.m.Y - h:m'); } | |
)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment