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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Drag & Drop on resouce page


Go to End


4 Posts   1511 Views

Avatar
Bambii7

Community Member, 254 Posts

27 July 2009 at 4:03pm

Does anyone have any hints on activating the drag and drop reordering as seen in the AssetManager?
In the example code of ResourcePage is it possible to activate it in the 'new FileDataObjectManager'. I thought it would be possible with $manager->showAll = true; or $manager->sortable();

I managed to get it going in a sense by adding
"SortOrder" => "Int"
to db array, and
static $default_sort = "SortOrder";
in Resource.php

then
$manager->showAll = true;
in ResourcePage.php

I'm not sure if there's an easier way or if there's anything wrong with the current method...

Avatar
UncleCheese

Forum Moderator, 4102 Posts

28 July 2009 at 3:45am

You need to add in your _config.php:

SortableDataObject::add_sortable_class('MyDataObject');

That will decorate in the field for you and handle the sort controller for that object. This is explained in the documentation.

Avatar
Bambii7

Community Member, 254 Posts

28 July 2009 at 9:03am

.........I saw that in the documentation, but was hellishly confused at how assetmanager was achieving it without being in the config. Thank you Mr Uncle Cheese, it works a beaut

Avatar
UncleCheese

Forum Moderator, 4102 Posts

28 July 2009 at 10:06am

Edited: 28/07/2009 10:08am

The DOM will automatically add file as a sortable class if you have override_asset_admin set to true.