I totally agree. This little addition (setting a var outside of the  
function and incrementing it) made the example work perfectly as a  
plaything. Rolling in the Ajax callback to get the "real" id will be  
another moment's work.

        Sortable.create("fList", {constraint:false})
        new Draggable('fish',{revert:true,ghosting:true})
        new Draggable('chicken',{revert:true,ghosting:true})
        Droppables.add('fList',
        {accept:'meat',onDrop:function(dragName,dropName)
        {placeFood(dragName,dropName)}})
        var added = 0;
        function placeFood(dragName,dropName) {
                added ++;
                $("fList").insert(new Element("li", { id: $(dragName).id+added 
}))
                $($(dragName).id+added).innerHTML = $(dragName).innerHTML
                Sortable.destroy("fList")
                Sortable.create("fList", {constraint:false})

        }

Thanks so much for the clarity.

Walter

On Jul 4, 2008, at 9:57 AM, Diodeus wrote:

> I look back to my pre-prototype/scripty days and think about how much
> work coding used to be. To think we can do stuff like this in a few
> line of code cooks my brain.


--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-spinoffs@googlegroups.com
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