Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9073 closed bug (notabug)

Can't call method "widget" on extended autocomplete

Reported by: spekary1 Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:

Description

See http://jsfiddle.net/spekary/mXYbt/21/.

Calling "widget" on an extended autocomplete produces a *Can't call methods on autocomplete prior to initialization. Attempted to call method "widget"* error. If I use jsfiddle to change to jQuery UI 1.8.18 and jQuery 1.7.2, the "widget" method works fine. Also, changing the example to not use the extended version of autocomplete, but just call autocomplete directly, that works fine too. Its the combination of jQuery 1.9.2, extending autocomplete using the widget factory, and calling the "widget" method. This appears to be broken in 1.10 as well.

Change History (3)

comment:1 Changed 7 years ago by Scott González

Resolution: notabug
Status: newclosed

What you're doing isn't officially supported, so just be warned that if this breaks we may not fix it. The problem you're running into though is documented in the 1.9 upgrade guide and 1.10 upgrade guide.

comment:2 Changed 7 years ago by spekary1

Which part isn't officially supported?

The autocomplete "widget" method to get the menu is documented here: http://api.jqueryui.com/autocomplete/#method-widget

You wrote an article on extending jquery ui widgets here: https://gist.github.com/scottgonzalez/962848.

Did I do something wrong in the override? Is the documentation old? What is the correct way to get the menu out of an extended autocomplete?

comment:3 in reply to:  2 Changed 7 years ago by Scott González

Replying to spekary1:

Which part isn't officially supported?

Copying the widget instance to another widget's namespace.

What is the correct way to get the menu out of an extended autocomplete?

Call the widget() method on the new widget you've created.

Here's the proper way to implement what you wanted: http://jsfiddle.net/mXYbt/43/ Though I have no idea what that close button is doing since clicking anywhere outside of the autocomplete will close the menu anyway. If you need more help, please use the forums or Stack Overflow.

Note: See TracTickets for help on using tickets.