Scriptaculous - Sortable.create() bug

B

bs9999

Im using Scriptaculous v1.7 to perform sortable drag drop. My display
uses:

Sortable.create('DocumentContainer_1',{tag:'div',onUpdate:SortUpdate,
handle:'Gripper',constraint:false,scroll:window});

There are about 5 div blocks with gripper hanldes next to them. Drag
drop sorting works fine. Later i perform an AJAX update within the
child region of the gripper div block updating it with new content.
Im trying to ALSO apply Sortable.create to this new content like so:

Sortable.create('Attachments_123',{tag:'div',overlap:'horizontal',
onUpdate:SortUpdateAttachment,
only:'AttachmentFile',constraint:false});

Whats happening here is the inner contents is made draggable within
its region amongst its 10 objects. The sorting works fine.

The prob im having is once i apply the Sortable.create for the
gripper child objects, the main level sortable objects stop working.

Why does this occur?
 
P

Peter Michaux

Im using Scriptaculous v1.7 to perform sortable drag drop. My display
uses:

Sortable.create('DocumentContainer_1',{tag:'div',onUpdate:SortUpdate,
handle:'Gripper',constraint:false,scroll:window});

There are about 5 div blocks with gripper hanldes next to them. Drag
drop sorting works fine. Later i perform an AJAX update within the
child region of the gripper div block updating it with new content.
Im trying to ALSO apply Sortable.create to this new content like so:

Sortable.create('Attachments_123',{tag:'div',overlap:'horizontal',
onUpdate:SortUpdateAttachment,
only:'AttachmentFile',constraint:false});

Whats happening here is the inner contents is made draggable within
its region amongst its 10 objects. The sorting works fine.

The prob im having is once i apply the Sortable.create for the
gripper child objects, the main level sortable objects stop working.

Why does this occur?

Folks around here aren't too fond of Prototype and Scriptaculous for
quite a few good reasons. If you are stuck using them then the Rails
spinoffs group is the place to ask

http://www.prototypejs.org/discuss

Peter
 
B

BloopleTech

Im using Scriptaculous v1.7 to perform sortable drag drop. My display
uses:

Sortable.create('DocumentContainer_1',{tag:'div',onUpdate:SortUpdate,
handle:'Gripper',constraint:false,scroll:window});

There are about 5 div blocks with gripper hanldes next to them. Drag
drop sorting works fine. Later i perform an AJAX update within the
child region of the gripper div block updating it with new content.
Im trying to ALSO apply Sortable.create to this new content like so:

Sortable.create('Attachments_123',{tag:'div',overlap:'horizontal',
onUpdate:SortUpdateAttachment,
only:'AttachmentFile',constraint:false});

Whats happening here is the inner contents is made draggable within
its region amongst its 10 objects. The sorting works fine.

The prob im having is once i apply the Sortable.create for the
gripper child objects, the main level sortable objects stop working.

Why does this occur?

Hi,
You need to change the Sortable.destroy function to fix it.

Replace the existing definition in dragdrop.js with this:
destroy: function(element)
{
var s = Sortable.options(element);
if(s)
{
if(element.id == s.element.id)
{ //Modification.
Draggables.removeObserver(s.element);
s.droppables.each(function(d)
{
Droppables.remove(d)
});

s.draggables.invoke('destroy');

delete Sortable.sortables[s.element.id];
}
}
},

This will solve your immediate problem; if some elements start
vanishing randomly in IE, try setting display to none and then back to
block for each CHILD list item.

Regards,
Brenton Fletcher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top