Skip to content

Hidden select and visible ui-select have different values #2082

Closed

Description

Image for: Description

When I hide options in my select by setting the hidden attribute and also preselect an option, then I get an error when opening the selectmenu.

Here is the code the jquery executes until the error occures:

... this.button.one( "focusin"); -> that._refreshMenu(); -> this._getSelectedItem().data( "ui-selectmenu-item" ); -> this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );

This happens because the options' DOM-element attribute selectedIndex does not match the index from the rendered ui-select-menu.
When I start selecting other entries now, the native select has a different value than what is displayed in the ui-selectmenu-button.

I also created a fiddle, in which the selectmenu won't open at all.

https://jsfiddle.net/isaraystanz/750p69qu/19/

On my local system the selectmenu will show and I can select entries, but the select's value gets messed up so I can't use it safely.

Metadata

Image for: Metadata

Metadata

Image for: Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Image for: Issue actions