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.

Customising the CMS /

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

Adding Drag & Drop functionality in Backend


Go to End


10 Posts   6456 Views

Avatar
SamSmooth

Community Member, 18 Posts

16 November 2010 at 6:09am

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

Community Member, 81 Posts

17 November 2010 at 12:06pm

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

Community Member, 18 Posts

17 November 2010 at 11:41pm

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

Community Member, 81 Posts

18 November 2010 at 1:18am

Edited: 18/11/2010 1:21am

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

Community Member, 18 Posts

18 November 2010 at 2:19am

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

Community Member, 81 Posts

18 November 2010 at 2:27am

heho

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

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

Avatar
SamSmooth

Community Member, 18 Posts

19 November 2010 at 10:48pm

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

Community Member, 81 Posts

19 November 2010 at 11:33pm

Edited: 19/11/2010 11:33pm

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. http://www.leftandmain.com/silverstripe-modules/2010/08/26/uploadify/

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