mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-02 20:04:43 +00:00
grouped prive and public methods
This commit is contained in:
parent
345fbbdacc
commit
09339ac534
1 changed files with 43 additions and 43 deletions
|
|
@ -41,39 +41,18 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
|
|||
return theme;
|
||||
},
|
||||
|
||||
selected: function() {
|
||||
return this.selectOptions.filter( ":selected" );
|
||||
_setDisabled: function( value ) {
|
||||
this.element.attr( "disabled", value );
|
||||
this.button.attr( "aria-disabled", value );
|
||||
return this._setOption( "disabled", value );
|
||||
},
|
||||
|
||||
selectedIndices: function() {
|
||||
_focusButton : function() {
|
||||
var self = this;
|
||||
|
||||
this.selected().map( function() {
|
||||
return self.selectOptions.index( this );
|
||||
}).get();
|
||||
},
|
||||
|
||||
setButtonText: function() {
|
||||
var self = this, selected = this.selected();
|
||||
|
||||
this.button.find( ".ui-btn-text" ).text( function() {
|
||||
if ( !self.isMultiple ) {
|
||||
return selected.text();
|
||||
}
|
||||
|
||||
return selected.length ? selected.map( function() {
|
||||
return $( this ).text();
|
||||
}).get().join( ", " ) : self.placeholder;
|
||||
});
|
||||
},
|
||||
|
||||
setButtonCount: function() {
|
||||
var selected = this.selected();
|
||||
|
||||
// multiple count inside button
|
||||
if ( this.isMultiple ) {
|
||||
this.buttonCount[ selected.length > 1 ? "show" : "hide" ]().text( selected.length );
|
||||
}
|
||||
setTimeout( function() {
|
||||
self.button.focus();
|
||||
}, 40);
|
||||
},
|
||||
|
||||
// setup items that are generally necessary for select menu extension
|
||||
|
|
@ -173,6 +152,41 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
|
|||
});
|
||||
},
|
||||
|
||||
selected: function() {
|
||||
return this.selectOptions.filter( ":selected" );
|
||||
},
|
||||
|
||||
selectedIndices: function() {
|
||||
var self = this;
|
||||
|
||||
this.selected().map( function() {
|
||||
return self.selectOptions.index( this );
|
||||
}).get();
|
||||
},
|
||||
|
||||
setButtonText: function() {
|
||||
var self = this, selected = this.selected();
|
||||
|
||||
this.button.find( ".ui-btn-text" ).text( function() {
|
||||
if ( !self.isMultiple ) {
|
||||
return selected.text();
|
||||
}
|
||||
|
||||
return selected.length ? selected.map( function() {
|
||||
return $( this ).text();
|
||||
}).get().join( ", " ) : self.placeholder;
|
||||
});
|
||||
},
|
||||
|
||||
setButtonCount: function() {
|
||||
var selected = this.selected();
|
||||
|
||||
// multiple count inside button
|
||||
if ( this.isMultiple ) {
|
||||
this.buttonCount[ selected.length > 1 ? "show" : "hide" ]().text( selected.length );
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
this.setButtonText();
|
||||
this.setButtonCount();
|
||||
|
|
@ -186,20 +200,6 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
|
|||
enable: function() {
|
||||
this._setDisabled( false );
|
||||
this.button.removeClass( "ui-disabled" );
|
||||
},
|
||||
|
||||
_setDisabled: function( value ) {
|
||||
this.element.attr( "disabled", value );
|
||||
this.button.attr( "aria-disabled", value );
|
||||
return this._setOption( "disabled", value );
|
||||
},
|
||||
|
||||
_focusButton : function() {
|
||||
var self = this;
|
||||
|
||||
setTimeout( function() {
|
||||
self.button.focus();
|
||||
}, 40);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue