Hello, I'm trying to implement the following with Sortable:

I have two lists -- in each list, the user can drag and drop to
reorder the elements inside. The tricky part is that some (but not
all) of the elements in the first list should also be draggable to the
second list; likewise, some from the second should be draggable to the
first.

I've tried implementing this using the "constraint" and "only"
options, but neither seem to help ("constraint" determines which
source lists the target list will accept elements from; "only," I
think, determines which elements inside the given list should be
draggable within that list; but neither determines which specific
elements from outside the target list the target list will accept).

It seems like what I need is something like the  "accept" option that
is available on a call to Droppables.add() -- a way to restrict
incoming elements by CSS class. Is there an equivalent way to
accomplish this with Sortables?

Sample code, which uses the nonfunctional "accept" option that I wish
existed, is below.

Thanks,

Michael

---

<div id="list1">
    <div class="free_item">i should be draggable to either list</div>
    <div class="list1_locked_item">i should be draggable only in
list1</div>
</div>

<div id="list2">
    <div class="free_item">i should be draggable to either list</div>
    <div class="list2_locked_item">i should be draggable only in
list2</div>
</div>

<script type="text/javascript">

    Sortable.create(
        "list1",
        {
            tag:'div',
            containment:['list1','list2'],
            accept:['free_item','list1_locked_item']
            constraint:false,
            dropOnEmpty:true,
        });

    Sortable.create(
        "list2",
        {
            tag:'div',
            containment:['list1','list2'],
            accept:['free_item','list2_locked_item']
            constraint:false,
            dropOnEmpty:true,
        });

</script>


--~--~---------~--~----~------------~-------~--~----~
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