akottr / dragtable

re-order table columns by using drag'n'drop
http://akottr.github.io/dragtable
MIT License
203 stars 166 forks source link

redraw fails after calling it more than one time on an element #33

Open benwill opened 9 years ago

benwill commented 9 years ago

First time it works fine, second time it actually throws the following:

Uncaught Error: cannot call methods on dragtable prior to initialization; attempted to call method 'redraw'jquery.js:3 n.extend.errorjquery-ui.js:6 (anonymous function)jquery.js:3 n.extend.eachjquery.js:3 n.fn.n.eachjquery-ui.js:6 e.fn.(anonymous function)

Any help be greatly appreciated, think its not destroying the components properly from what I can tell, great widget otherwise

manishnagdewani96170 commented 9 years ago

You need to call query like this : $(table).dragtable('destroy').dragtable({});