jQuery UI Sortable: possible to sort on <button> sub-elements

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 !

Upvotes: 1

Views: 1275

Answers (1)

Irvin Dominin
Irvin Dominin

Reputation: 30993

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/

Upvotes: 2

Related Questions