PHP code example of restruct / silverstripe-groupable-gridfield
1. Go to this page and download the library: Download restruct/silverstripe-groupable-gridfield library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
restruct / silverstripe-groupable-gridfield example snippets
$gfConfig = GridFieldConfig::create()
// setup your config as usual, must wGroupButton
->addComponent(new GridFieldAddNewGroupButton('buttons-before-right'))
->addComponent(new GridFieldGroupable(
'Phase', // field on subjects to hold group key
$this->fieldLabel('Phase'), // label of group field
'none', // fallback/unassigned group name
null, // (fixed) list of available groups (key value), set to null to use MultiValue field instead
'Phases' // name of MultiValueField on source record to provide groups (allows adding new on-the-fly)
));