Im no pro here but i think i can help a lil.
Most classic way is to have 2 sortable lists so you can drag from 1 to
the other, the key thing here is "containment".
Somewhere i used this code:
// to add a section use:
// sectionControl.newSection('listname','vertical',uniqueid);
sections = new Array;
displays = new Array;
var sectionControl = {
newSection: function(name,display,uniqueid) {
var name = $(name).id;
if (name != '') {
sections.push(name);
displays.push(display);
sectionControl.groupRemove();
sectionControl.groupAdd(display,uniqueid);
}
},
groupRemove: function() {
for(var i = 0; i < sections.length; i++) {
MochiKit.Sortable.Sortable.destroy(sections[i]);
}
},
groupAdd: function(display,uid) {
for(var i = 0; i < sections.length; i++) {
MochiKit.Sortable.Sortable.create(sections[i],{
tag:'div',
only:'draggable',
constraint:false, //allows horizontal and vertical
dragging
dropOnEmpty: true,
overlap:displays[i],
containment: sections
});
}
}
}
containment: sections --> the DOM id of the the sortable lists that
accept these droppables. This properties determines witch lists share
the draggable icons so i need to update this array everytime i want to
add another sortable list if i create them dinamically, thats why
there is groupadd and groupremove.
overlap:displays[i] --> this will determine if the draggable should
push the other dragables down or to the right when you float them over
while dragging things around. so you can work with both horizontal
and vertical sortable lists. I'm working with this array here so i can
have both vertical and horizontal lists in the same sortable group. To
easily understand how this "overlap" works, build a horizontal list
inside some div that has a smaller width than the list itself so it
automatically pushes the rest of the list to the next line. Then try
dragging things horizontally and then vertically.
heres a simple little example:
http://www.mfacil.com/overlappingDivs.html
And dont worry, Mochikit uses scriptaculous for this so its absolutely
the same.
Good luck there!
Bruno
On 25 abr, 16:21, WLQ <[email protected]> wrote:
> So I've got a sortable list. Now what I want to do is to have ability
> to drop items on it.
> Like: being able to drop other items from other lists.
>
> Here's to create a sortable list: Sortable.create("tasksList",
> {tag:"li"});
>
> So how can I drop other elements into it?
>
> Thanks, Yan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---