Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Drag and drop reordering of SS3 Grid Field

Go to End

7 Posts   7151 Views


Community Member, 48 Posts

19 July 2012 at 3:13pm

Edited: 19/07/2012 3:14pm

I seem to be very good at creating ghost town posts on this forum but thought I'd have one last attempt.

There is very minimal documentation out there on SS3 Grid Fields at the moment. I am looking for a way to achieve drag and drop (or another method) reordering of the items in a Grid Field. Using the dataobjectmanager in SS2.4 I just had to add SortableDataObject::add_sortable_class('Classname') to my config file and hey presto, I could order the items.

Does anyone know how I can achieve this with Grid Fields in SS3?


Community Member, 473 Posts

19 July 2012 at 3:46pm

Hey Fraser

There's a Sortable Grid Field module that provides a component for allowing drag and drop reordering of GridField objects. You just need to provide a sort field.


Community Member, 48 Posts

19 July 2012 at 3:52pm


Thanks Simon.


Community Member, 2 Posts

4 January 2013 at 5:47am


i have installed this plugin but i dont have an idea how i can use this module.

I try it on an example from the official tutorial ( but it doesnt work.

Where i can find a usable tutorial?


Community Member, 189 Posts

4 January 2013 at 5:58am

Edited: 04/01/2013 5:58am

Hi LuiLoop. Setting up the SortableGridField is pretty easy. Here's an example

In your DataObject class, you need to first create a column to sort by. I usually use something simple like SortID.

class MyDataObject extends DataObject {
    public static $db=array(

then where you're setting up your gridfield, add the SortableGridFieldComponent.

class Page extends SiteTree {

    public static $has_many=array(

    public function getCMSFields(){
                GridField::create('MyDataObjects', 'Data Object', 
                        ->addComponent(new GridFieldSortableRows('SortID')) //use addComponent() function to add SortableGridFieldRows

        return $fields;

hope that helps!


Community Member, 2 Posts

4 January 2013 at 8:31pm

Edited: 04/01/2013 8:56pm

thx, now it works

But i have a litle second question. How i can create a DropDownField in my Gridfield - i cant find any documentation


Community Member, 15 Posts

6 January 2013 at 9:39pm

Edited: 06/01/2013 9:40pm

Hi LuiLoop,

thanks for this post was very helpfull just now... with the dropdown list, i discovered i could use an Enum data type.
worked for what i needed, let me know if that works for you or if you find another way..

  static $db = array(
        'Name' => 'Varchar(255)',
		'Title' => 'Varchar(255)',
		'Visible' => "Enum('Yes, No')",