Thanks for answering but this isn't what I meant.
I know about tree sorting, not using it for this project though.
My question was about telling a droppable (or sortable if I would go
for your suggestion) what kind of elements to accept, and which not.
So for some folder (node) it's OK to receive a subfolder, but for
another it's not.
The rules as to what to accept can be more complex than just css class
names, so I was asking for a way around the standard 'accept' option
behavior on droppables (or sortables for that sake).

Thanks anyway :)


On 22 nov, 01:40, LexNonScripta <[EMAIL PROTECTED]> wrote:
> At first I didn't find a way to make an element take up new child
> elements, i.e. a way to make item2 (sibling of item1) go "under" item1
>
> Then I inserted a "faux" UL inside every LI under the tree element (do
> this before you start the sortable). Since this didn't work, I had to
> make an empty LI inside every faux UL. Set some on-the-fly CSS (height
> of the faux LI has to be more than 1px, otherwise it's hard to hit the
> right spot) and you have yourself a LI that accepts new items to it's
> hidden UL.
>
> here's the complete function:
>
> //// CREATE SORTABLE TREE LIST WHICH ACCEPTS NEW CHILD ELEMENTS
>
> function sortableTreeAdvanced(element){
>
>         element = $(element);
>         element.select('li').each( // this is each LI recursive
>         function (li){
>                 if (!li.down('ul')){ // make sure that an child UL does not 
> already
> exist
>                         /// now let's create a faux UL, which is more-
> or-less hidden, so it can accept new mushrooms
>                         var fauxUL=document.createElement('ul');
>                         var fauxLI=document.createElement('li');
>                         fauxLI.style.height = '3px';
>                         fauxLI.style.listStyleType = 'none';
>                         fauxUL.appendChild(fauxLI);
>
>                         li.appendChild(fauxUL); // put the hidden list inside 
> the LI
>                 }
>         }); /// end each LI
>
>         Sortable.create(element, { tree:true, treeTag:'ul'} );
>
> }
>
> sortableTreeAdvanced('sortable_test');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to