Sortable UI Module

14 views
Skip to first unread message

DAZ

unread,
Aug 11, 2011, 10:50:07 AM8/11/11
to RightJS
Hi,

I'm playing around with the sortable module and have a simple list
like this:

<ul id='shopping'>
<li id='item-1'>Apples <a href='/delete/task/1'>delete</a></li>
<li id='item-2'>Milk <a href='/delete/task/2'>delete</a></li>
<li id='item-3'>Eggs <a href='/delete/task/3'>delete</a></li>
</ul>

new Sortable('shopping');

This works fine - the list now becomes sortable, but the delete links
do not work - they just act as a handle for the dragging. I realise I
can specify a particular handle, but is it possible for the whole list
item to act as the handle AND any links inside the list-item to still
work?

cheers,

DAZ

Nikolay Nemshilov

unread,
Aug 11, 2011, 12:46:48 PM8/11/11
to rig...@googlegroups.com
Hi Daz,

It works like that, the event bubbles from A -> LI -> UL <- and here we catch it. The widget processes all the internal elements because there might be some formatting in there, images and so on.

In order to make it work you have to either add an "onclick" attribute directly to your A, or (which is better) use the `handleCss` option to specify elements that should be used as the handler, kind like this http://rightjs.org/ui/sortable/demo#custom then events from your links will fall through to the document where it will be caught by the browser or your UJS handlers.


--
Thanks,
Nikolay

--
You received this message because you are subscribed to the Google Groups "RightJS" group.
To post to this group, send email to rig...@googlegroups.com.
To unsubscribe from this group, send email to rightjs+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rightjs?hl=en.


Reply all
Reply to author
Forward
0 new messages