mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: add renderItemData method similar to autocomplete
This commit is contained in:
parent
d4f13bc213
commit
666927ba91
@ -16,7 +16,7 @@
|
|||||||
$.widget( "custom.iconselectmenu", $.ui.selectmenu, {
|
$.widget( "custom.iconselectmenu", $.ui.selectmenu, {
|
||||||
_renderItem: function( ul, item ) {
|
_renderItem: function( ul, item ) {
|
||||||
var element, span,
|
var element, span,
|
||||||
li = $( "<li>" ).data( "ui-selectmenu-item", item );
|
li = $( "<li>" );
|
||||||
|
|
||||||
if ( item.disabled ) {
|
if ( item.disabled ) {
|
||||||
li.addClass( "ui-state-disabled" ).text( item.label );
|
li.addClass( "ui-state-disabled" ).text( item.label );
|
||||||
|
12
ui/jquery.ui.selectmenu.js
vendored
12
ui/jquery.ui.selectmenu.js
vendored
@ -163,11 +163,11 @@ $.widget( "ui.selectmenu", {
|
|||||||
|
|
||||||
var item,
|
var item,
|
||||||
options = this.element.find( "option" );
|
options = this.element.find( "option" );
|
||||||
|
|
||||||
if ( !options.length ) {
|
if ( !options.length ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._readOptions( options );
|
this._readOptions( options );
|
||||||
this._renderMenu( this.menu, this.items );
|
this._renderMenu( this.menu, this.items );
|
||||||
|
|
||||||
@ -235,12 +235,16 @@ $.widget( "ui.selectmenu", {
|
|||||||
}).appendTo( ul );
|
}).appendTo( ul );
|
||||||
currentOptgroup = item.optgroup;
|
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 ) {
|
_renderItem: function( ul, item ) {
|
||||||
var li = $( "<li>" ).data( "ui-selectmenu-item", item ),
|
var li = $( "<li>" ),
|
||||||
a = $( "<a>", { href: "#" });
|
a = $( "<a>", { href: "#" });
|
||||||
|
|
||||||
if ( item.disabled ) {
|
if ( item.disabled ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user