restruct/silverstripe-groupable-gridfield

This module allows drag & drop grouping of items in a GridField

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 3

Forks: 9

Open Issues: 1

Type:silverstripe-vendormodule

2.0.0 2025-09-24 09:34 UTC

This package is auto-updated.

Last update: 2025-09-24 09:44:55 UTC


README

Build Status codecov.io

This module facilitates drag & drop grouping of items in a GridField.
It bolts on top of- and depends on GridFieldOrderableRows for the drag & drop sorting functionality.
Allows adding new 'groups' on the fly when configured with a MultiValueField to store them.
Groups themselves can also be reordered (drag-drop, experimental).

groupable

NOTE: currently slightly 'WIP'

We found a (Silverstripe 3) project in which quite a lot of development was done on this module which never got published (a.o. group reordering). These updates + additions have now been included + updated in this module but may still need a bit of work/debugging.

  • Updated namespace micsck\GroupableGridfield -> Restruct\Silverstripe\GroupableGridfield

Usage:

$gfConfig = GridFieldConfig::create()
    // setup your config as usual, must include orderable rows
    ->addComponent(new GridFieldOrderableRows())
    // add Groupable + AddNewGroupButton
    ->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)
    ));

Thanks