logo       

Passing "accept" option through a Sortable: msg#00096

lang.ruby.rails.spinoffs

Subject: Passing "accept" option through a Sortable

Hi All,

I'm attempting to tweak Scriptaculous 1.5R4 to provide the ability to pass the "accept" option through the Sortable.create(...) call to the enclosed Droppable(s). I'm far from a JavaScript expert (Scriptaculous & AJAX have convinced me to finally start learning), so I'm kinda fumbling in the dark here.

Thus far I've made two minor changes to 'dragdrop.js':

o Added 'accept: options.accept' to 'options_for_droppable' (line 395)
o Added 'accept: options.accept' to the metadata for handling dropOnEmpty (line 409)

Things work OK, except for the following case:

1. There are two lists
2. List #1 contains one items with CSS class "capitalized" and another with CSS class "lower"
3. List #2 will only accept items with CSS class "capitalized".
4. Drag the "capitalized" item from #1 to #2, which (correctly) gets accepted.
5. Try to drag the "lower" item from #1 to #2, and we see the trouble. The droppables surrounding the items that were originally in list #2 won't accept it, but the droppables surrounding the item that was previously in list #1 **will** accept it.

So, it seems like I'm almost there, but not quite. Any suggestions as to what to do to make dropped items get the correct 'accept' option? Attached a basic HTML page I've been using to play around with it.


TIA,

Peter


List #1
ONE
two
THREE


List #2
A
B
C

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@xxxxxxxxxxxxxxxx
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise