Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI sortable table handle

I'm having some difficults with sortable option handle.

When I use:

$("table tr").sortable().disableSelection();

There is no problem.

If I add the handle option then the sortable stops working:

$("table tr").sortable({
    handle: "td:eq(0)"
}).disableSelection();

The links:

http://jsfiddle.net/22C2n/

http://jsfiddle.net/22C2n/1/

Can anyone help me please?

like image 202
Diego Avatar asked Dec 17 '10 14:12

Diego


2 Answers

Wrap your <tr>'s in a <tbody> and change your code to:

$("table tbody").sortable({
    handle: 'td:first'
}).disableSelection();

You specify the container that contains the elements you want to be sortable not the actual elements...

like image 172
mike Avatar answered Oct 05 '22 23:10

mike


Try to pass an element: http://jsfiddle.net/22C2n/5/

$("table tr").sortable({
    handle: $("td:eq(0)")
}).disableSelection();
like image 30
Reto Aebersold Avatar answered Oct 05 '22 22:10

Reto Aebersold