35

I am trying to sort tr's in a table.

code

$("table tbody").sortable({
    handle: 'button'
    //handle: 'img'
}).disableSelection();

live fiddle

now the problem is when using img as handle its working fine

but when using button as handle its not working

I checked for many jquery ui sortable ques for my ans but of no help

can anyone plz explain why is this happening

Thanx in advance

1

2 Answers 2

75

The cancel option defaults to :input,button which conflicts with your handle setting. Just setting it to an empty string works fine.

$("table tbody").sortable({ 
    handle: 'button',
    cancel: ''
})

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

Sign up to request clarification or add additional context in comments.

3 Comments

thanx a lot Nal :) How I overlooked the default option for cancel!!
$("table tbody").sortable({ handle: 'button', cancel: '' }).disableSelection();
handle option has replaced with items option-handle option-items
0

The button doesn't work as a handle. Instead, use Span or Div, give it button styling, and use it as a handle.

Reason: The Ui sortable gets confused by button functionality. Either it had to take a click or drag, so it does not work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.