this.menuInstance = this.menu.menu({
role: "listbox",
select: function( event, ui ) {
- event.preventDefault();
+ event.preventDefault();
that._select( ui.item.data( "ui-selectmenu-item" ), event );
},
focus: function( event, ui ) {
},
refresh: function() {
+ this._refreshMenu();
+ this._setText( this.buttonText, this._getSelectedItem().text() );
+ },
+
+ _refreshMenu: function() {
this.menu.empty();
var item,
this.menuInstance.focus( null, item );
this._setAria( item.data( "ui-selectmenu-item" ) );
- this._setText( this.buttonText, item.text() );
-
// Set disabled state
this._setOption( "disabled", this.element.prop( "disabled" ) );
},
// If this is the first time the menu is being opened, render the items
if ( !this.menuItems ) {
- this.refresh();
+ this._refreshMenu();
} else {
// TODO: Why is this necessary?
// Shouldn't the underlying menu always have accurate state?
focusin: function() {
// Delay rendering the menu items until the button receives focus
if ( !this.menuItems ) {
- this.refresh();
+ this._refreshMenu();
}
this._off( this.button, "focusin" );
},