]> source.dussan.org Git - jquery-ui.git/commitdiff
Selectmenu: add renderItemData method similar to autocomplete
authorFelix Nagel <info@felixnagel.com>
Mon, 29 Apr 2013 21:05:07 +0000 (23:05 +0200)
committerFelix Nagel <info@felixnagel.com>
Mon, 29 Apr 2013 21:05:07 +0000 (23:05 +0200)
demos/selectmenu/custom_render.html
ui/jquery.ui.selectmenu.js

index 09e6811f037d8fef1e0f5b86dad041e316b0c261..03f873d198652b7ec3d1d4a5fd3410ee9d027176 100644 (file)
@@ -16,7 +16,7 @@
                $.widget( "custom.iconselectmenu", $.ui.selectmenu, {
                        _renderItem: function( ul, item ) {
                                var element, span,
-                                       li = $( "<li>" ).data( "ui-selectmenu-item", item );
+                                       li = $( "<li>" );
 
                                if ( item.disabled ) {
                                        li.addClass( "ui-state-disabled" ).text( item.label );
index ffcfcb852a6de93dfde099881ddea89baaaa975a..4ec8fcd8df7f0e8b15de4a8a4382946bc2437d19 100644 (file)
@@ -163,11 +163,11 @@ $.widget( "ui.selectmenu", {
 
                var item,
                        options = this.element.find( "option" );
-                       
+
                if ( !options.length ) {
                        return;
                }
-               
+
                this._readOptions( options );
                this._renderMenu( this.menu, this.items );
 
@@ -235,12 +235,16 @@ $.widget( "ui.selectmenu", {
                                }).appendTo( ul );
                                currentOptgroup = item.optgroup;
                        }
-                       that._renderItem( ul, item );
+                       that._renderItemData( ul, item );
                });
        },
 
+       _renderItemData: function( ul, item ) {
+               return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
+       },
+
        _renderItem: function( ul, item ) {
-               var li = $( "<li>" ).data( "ui-selectmenu-item", item ),
+               var li = $( "<li>" ),
                        a = $( "<a>", { href: "#" });
 
                if ( item.disabled ) {