diff options
author | Felix Nagel <info@felixnagel.com> | 2012-02-21 23:41:00 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-02-21 23:41:00 +0100 |
commit | 52e43c076fc92c88d7a5ea5f101e7d7a9922afea (patch) | |
tree | a52e3f756d47c84dd85f26d8a05d7681b0799948 /ui/jquery.ui.selectmenu.js | |
parent | d0c31c188ed496f6d18265c6e41c91509bc03bbe (diff) | |
download | jquery-ui-52e43c076fc92c88d7a5ea5f101e7d7a9922afea.tar.gz jquery-ui-52e43c076fc92c88d7a5ea5f101e7d7a9922afea.zip |
Selectmenu: re-enabled lazy loading of the menu items (menu refresh)
Diffstat (limited to 'ui/jquery.ui.selectmenu.js')
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 3e5f0816a..5dfd6af75 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -54,7 +54,6 @@ $.widget( "ui.selectmenu", { this._bind( this.button, this._buttonEvents ); this._drawMenu(); - this.refresh(); if ( this.options.disabled ) { this.disable(); @@ -70,7 +69,7 @@ $.widget( "ui.selectmenu", { // create button this.button = $( '<a />', { href: '#' + this.ids.id, - html: ' ', + html: this.element.find( "option:selected" ).text() || ' ', tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ), id: this.ids.button, width: this.element.outerWidth(), @@ -316,6 +315,11 @@ $.widget( "ui.selectmenu", { }, _buttonEvents: { + focus: function( event ) { + // init Menu on first focus + this.refresh(); + this.button.unbind( "focus." + this.widgetName ); + }, click: function( event ) { this._toggle( event ); event.preventDefault(); @@ -389,7 +393,7 @@ $.widget( "ui.selectmenu", { _setSelected: function( item ) { var link = this._getSelectedItem().find("a"); // update button text - this.button.button( "option", "label", item.label ); + this.button.find( "span.ui-button-text" ).html( item.label ); // change ARIA attr this.button.add( this.menu ).attr( "aria-activedescendant" , link.attr( "id" ) ); this.menuItems.find("a").attr( "aria-selected", false ); |