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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Drag & Drop on resouce page


Reply

4 Posts   895 Views

Avatar
Bambii7

27 July 2009 at 4:03pm Community Member, 254 Posts

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

28 July 2009 at 3:45am 4085 Posts

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

28 July 2009 at 9:03am Community Member, 254 Posts

.........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

28 July 2009 at 10:06am (Last edited: 28 July 2009 10:08am), 4085 Posts

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