I ran into this issue too. My solution was to add an "onUpdate" function to
the sortable that tests the container to see if it's got any children or
not:

function is_empty(container)
{
        if ($(container).hasChildNodes()) {
                Element.removeClassName($(container),'empty');
        } else if (!$(container).hasChildNodes()) {
                Element.addClassName($(container),'empty');
        }
}

I was using this for 2 sortable (UL) lists - my class for the "empty"
sortable just padded the container:

.empty {
        padding: 10px;
        border: 1px dashed #FFDD44;
        background-color: #FFFF99;
}

The padding and style was enough to give a visible "target" for the users to
drop on.

 - bry


> Does anyone have a good solution for using script.aculo.us 
> drag and drop sorting with multiple lists when one or more of 
> those lists might start out empty?
> 
> I want to drop from list A to list B, but unless B starts out 
> with something
> in it, there's no drop target there.   My guess is that I 
> could put "None"
> in the empty lists and then write some javascript to remove 
> the word "None"
> when something was dropped and add it back if the last item 
> is removed. It just feels messy to me.
> 
> Any thoughts/help is greatly appreciated.

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to