Skip to main content

Search and Top Navigation

#9073 closed bug (notabug)

Opened February 09, 2013 09:26AM UTC

Closed February 09, 2013 02:41PM UTC

Last modified February 10, 2013 06:02PM UTC

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.

Attachments (0)
Change History (3)

Changed February 09, 2013 02:41PM UTC by scottgonzalez comment:1

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.

Changed February 09, 2013 05:35PM UTC by spekary1 comment:2

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?

Changed February 10, 2013 06:02PM UTC by scottgonzalez comment:3

Replying to [comment:2 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.