Skip to main content

Search and Top Navigation

#10662 closed bug (fixed)

Opened October 17, 2014 02:46PM UTC

Closed January 12, 2015 06:01PM UTC

Last modified April 06, 2016 12:28PM UTC

Selectmenu: Calling refresh() after removing all options throws an error

Reported by: janom Owned by:
Priority: minor Milestone: 1.12.0
Component: ui.selectmenu Version: 1.11.1
Keywords: Cc:
Blocked by: Blocking:
Description

after remove all options from select and then call refresh on selectmenu, i get error: "this.menuItems is undefined"

http://jsfiddle.net/janom/w0q994gu/

Attachments (0)
Change History (13)

Changed October 18, 2014 01:41AM UTC by tj.vantoll comment:1

status: newopen
summary: selectmenu refresh empty options throw errorSelectmenu: Calling refresh() after removing all options throws an error

Changed October 22, 2014 11:07AM UTC by janom comment:2

_comment0: I changed selectmenu javascript... can you please check if my solutions is right? \ in _refreshMenu: function() i change from this lines: \ if ( !options.length ) { \ return; \ } \ \ this._parseOptions( options ); \ this._renderMenu( this.menu, this.items ); \ \ this.menuInstance.refresh(); \ this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ); \ to this lines: \ this._parseOptions( options ); \ this._renderMenu( this.menu, this.items ); \ \ this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ); \ \ if ( !options.length ) { \ return; \ } \ \ this.menuInstance.refresh(); \ \ and in open: function( event ) i change this line: \ if ( !this.menuItems ) { \ to this line: \ if ( !this.menuItems || this.menuItems.length==0) {1413976173331218

I changed selectmenu javascript... can you please check if my solutions is right?

in _refreshMenu: function() i change from this lines:

		if ( !options.length ) {
			return;
		}

		this._parseOptions( options );
		this._renderMenu( this.menu, this.items );

		this.menuInstance.refresh();
		this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );

to this lines:

		this._parseOptions( options );
		this._renderMenu( this.menu, this.items );

		this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );

		if ( !options.length ) {
			return;
		}

		this.menuInstance.refresh();

and in open: function( event ) i change this line:

		if ( !this.menuItems ) {

to this line:

		if ( !this.menuItems || this.menuItems.length==0) {

Changed October 22, 2014 12:19PM UTC by tj.vantoll comment:3

If you're interested in submitting a patch please do so as a pull request.

Changed October 23, 2014 07:24AM UTC by janom comment:4

Changed January 12, 2015 06:01PM UTC by Scott González comment:5

resolution: → fixed
status: openclosed

Selectmenu: Better handling when there are no options

Fixes #10662

Closes gh-1370

Closes gh-1423

Changeset: 65584c1640f8c7430587738c3c4cd7dd8010a2a5

Changed January 12, 2015 06:01PM UTC by scottgonzalez comment:6

milestone: none1.12.0

Changed April 24, 2015 01:22PM UTC by scottgonzalez comment:7

#12262 is a duplicate of this ticket.

Changed April 06, 2016 09:53AM UTC by alexandis comment:8

_comment0: Excuse me, I'm experiencing the same problem on jquery UI 1.11.4 now, downloaded from official link. \ How come that the code there is old - not the one that is present in the [https://github.com/jquery/jquery-ui/commit/65584c1640f8c7430587738c3c4cd7dd8010a2a5 fix]?1459939208213666

Excuse me, I'm experiencing the same problem on jquery UI 1.11.4 now, downloaded from official link.

How come that the code there is old - not the one that is present in the fix?

I've tried to replace piece of code, related to selectmenu, from selectmenu.js from github.

But then getting exception here: var item = ui.item.data("ui-selectmenu-item"); in focus event, since ui.item is empty object...

Changed April 06, 2016 10:34AM UTC by scottgonzalez comment:9

The milestone on this ticket is 1.12.0, which means that the fix wouldn't be included in 1.11.4.

Changed April 06, 2016 10:43AM UTC by alexandis comment:10

Replying to [comment:9 scottgonzalez]:

The milestone on this ticket is 1.12.0, which means that the fix wouldn't be included in 1.11.4.

Ok. Then how should i fix the issue with refreshing after removing options? Thanks.

Changed April 06, 2016 10:46AM UTC by scottgonzalez comment:11

Upgrade to the latest pre-release of 1.12.0.

Changed April 06, 2016 12:09PM UTC by alexandis comment:12

Replying to [comment:11 scottgonzalez]:

Upgrade to the latest pre-release of 1.12.0.

Thank you. I've replaced 1.11.4 with 1.12 release candidate, but now I got exception when trying to create dialog object (where 1.11.4 worked properly): effectMethod is undefined (effectMethod = $.effects.effect[ args.effect ], args.effect is true, not some effect name). Unfortunately, it's not possible to send call stack from Firebug...

Changed April 06, 2016 12:28PM UTC by scottgonzalez comment:13

Please create a new ticket as this is unrelated. Thanks.