1

I have a table which I succeeded in making sortable with the Sortable JQueryUI functionality.

My question is : is there a way to sort the elements of this table by clicking and holding sub-elements (in my case, buttons in the lines of the table) ?

Thanks in advance for your answers !

2
  • Can you show your current code? Commented Jan 6, 2014 at 16:58
  • You can surely, could you set up a jsfiddle for us to help u? Commented Jan 6, 2014 at 17:00

1 Answer 1

2

With span, div, td, and other elements works fine.

On buttons y default is not possible because the cancel option is set to input,textarea,button,select,option so the button will not handle the sortable.

Ref:

Prevents sorting if you start on elements matching the selector.

You can set it to empty string, or set a string without button and it will work

Code:

$("#languages tbody").sortable({
    cancel: ''
}).disableSelection();

Demo: http://jsfiddle.net/IrvinDominin/9XDVM/

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

2 Comments

OK, I didn't express myself very well, but your answer helped me. I should have specified « is there a way to sort the elements of this table by clicking and holding only certain sub-elements ». In my case the cancel selector is : 'td:not(.clickable-zone)'.
@Pierre-YvesLeDévéhat glad to help you; I changed a bit title, if you want you can change it too or add more code

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.