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.

Customising the CMS

Adding Drag & Drop functionality in Backend


Go to End
Reply

10 Posts   3989 Views

Avatar
SamSmooth

16 November 2010 at 6:09am Community Member, 18 Posts

Hi.

I have set-up a gallery using "getCMSFields_forPopup".

For sorting I'm using a integer text-field called "position", but this is not very comfortable to maintain.

Is it possible to let the admin sort the pictures using drag&drop?

Thank you!

Sam

Avatar
lerni

17 November 2010 at 12:06pm Community Member, 80 Posts

hi
if you use DataObjectManger you could add a sortable option to it. have a look here
http://ssbits.com/snippets/2010/a-data-object-manager-cheatsheet/

Avatar
SamSmooth

17 November 2010 at 11:41pm Community Member, 18 Posts

Thank you lerni.

Unfortunately this doesn't work. I read that "SortableDataObject" is not usable for the backend.

http://doc.silverstripe.org/modules:sortabledataobject

"The sorting takes place not in the CMS, but rather on the front end for logged in administrators."

Or didn't I get this right?

Cheers,
Sam

Avatar
lerni

18 November 2010 at 1:18am (Last edited: 18 November 2010 1:21am), Community Member, 80 Posts

heho
whith DOM it certainly is usable in the backend - never used it in the frontend. just add the option in your _config.php

SortableDataObject::add_sortable_classes(array('YourObject'));

do a .../dev/build, log back in to to backend and your done!

Avatar
SamSmooth

18 November 2010 at 2:19am Community Member, 18 Posts

Well, I can see the "Allow drag & drop reordering" checkbox, but it doesn't change a thing when being checked.
Additionally the list is not a table anymore (I changed the object from ComplexTableField to DataObjectManager).

Plus the backend assets Management now claims "Error: DataObjectManager requires the Uploadify or SWFUpload modules.", after putting "modules-dataobject_manager-r511" into the root-dir.

I'm too dumb obviously... :(

Avatar
lerni

18 November 2010 at 2:27am Community Member, 80 Posts

heho

Do you have DataObjectManager installed an named the directory like "dataobject_manager"

DOM = DataObjectManager
http://www.silverstripe.org/dataobjectmanager-module/

Avatar
SamSmooth

19 November 2010 at 10:48pm Community Member, 18 Posts

Thank you learni! This was the right hint! The directory-name was wrong. Drag-&-Drop-sorting now works like a charme.

Unfortunately I still get the "Error: DataObjectManager requires the Uploadify or SWFUpload modules." when choosing the assets-management "Files & Images". Do you have an idea?

Sam

Avatar
lerni

19 November 2010 at 11:33pm (Last edited: 19 November 2010 11:33pm), Community Member, 80 Posts

hi sam

it basically means what it says - you have to upload/install Uploadify or SWFUpload ;-)

newer versions of DOM work with Uploadify older with SWFUpload. [url]http://www.leftandmain.com/silverstripe-modules/2010/08/26/uploadify/[/url]

if you wana turn-off DOM for assets you can add the following to your _config.php

DataObjectManager::allow_assets_override(false);

Go to Top