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, biapar, Willr, Ingo, swaiba, simon_w

Drag and drop reordering of SS3 Grid Field


7 Posts   3477 Views


19 July 2012 at 3:13pm (Last edited: 19 July 2012 3:14pm), Community Member, 46 Posts

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?


19 July 2012 at 3:46pm Forum Moderator, 474 Posts

Hey Fraser

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


19 July 2012 at 3:52pm Community Member, 46 Posts


Thanks Simon.


4 January 2013 at 5:47am Community Member, 2 Posts


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?


4 January 2013 at 5:58am (Last edited: 4 January 2013 5:58am), Community Member, 189 Posts

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!


4 January 2013 at 8:31pm (Last edited: 4 January 2013 8:56pm), Community Member, 2 Posts

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


6 January 2013 at 9:39pm (Last edited: 6 January 2013 9:40pm), Community Member, 15 Posts

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')",