Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#8820 closed bug (notabug)

.sortable('destroy') fails in widget.bridge with uncaught exception 'cannot call methods prior to initialization'.

Reported by: fwdillema Owned by: fwdillema
Priority: minor Milestone: 1.10.0
Component: ui.sortable Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


.sortable('destroy') fails with uncaught exception 'cannot call methods prior to initialization'.

This occurs when using jquery-ui 1.9.1 together with jquery-1.7.2. Upgrading jquery to 1.8 makes this issue disappear, but as jquery-ui claims it should work with jquery-1.6 and up, I still regard this a bug.

the exception occurs here in widget.bridge, because $.data( this, fullName ); returns nothing with jquery-1.7.2:

if ( isMethodCall ) {

this.each(function() {

var methodValue,

instance = $.data( this, fullName );

if ( !instance ) {

return $.error( "cannot call methods on " + name + " prior to initialization; " +

"attempted to call method '" + options + "'" );


Change History (5)

comment:1 Changed 10 years ago by fwdillema

I was mistaken; upgrading jquery to 1.8 did not fix the issue.

comment:2 Changed 10 years ago by Scott González

Component: ui.widgetui.sortable
Owner: set to fwdillema
Status: newpending

I'm not seeing any problems:

Please provide a reduced test case showing the problem.

comment:3 Changed 10 years ago by fwdillema

Status: pendingnew

My apologies, I attributed the bug to the wrong plugin. It was the plugin that used sortable that was wrong and called destroy multiple times.

The caller tried to destroy sortable only when it thought sortable was initialized on an element, something like:

if ($('#sortable').sortable) {



Maybe this used to work, but the above check now remains true after destroy has been called and thus the check is not doing its job.

comment:4 Changed 10 years ago by Scott González

Resolution: notabug
Status: newclosed

That check has never been correct. That checks if the sortable plugin exists, not if a specific instance exists. The correct check is $( "#sortable" ).data( "ui-sortable" ).

comment:5 Changed 9 years ago by Hernaldo

In my case, I use: jQuery UI - v1.9.2, and I have only:


and I get: Uncaught Error: cannot call methods on sortable prior to initialization; attempted to call method 'destroy'

And I fixed when add the validation:

if ($ "ui-sortable" )) { $this.sortable("destroy"); }

Version 0, edited 9 years ago by Hernaldo (next)
Note: See TracTickets for help on using tickets.