Skip to content
Browse files

Checkboxradio: Allow to set option mini programmatically. Fixes #4070.

  • Loading branch information...
1 parent 5b537ca commit 7f6c0ac7abb64508fcd4b2d16250b79fd0dd9a1d @jaspermdegroot jaspermdegroot committed Nov 8, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 js/jquery.mobile.forms.checkboxradio.js
View
10 js/jquery.mobile.forms.checkboxradio.js
@@ -16,11 +16,13 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.widget", "./jquery.
$.widget( "mobile.checkboxradio", $.mobile.widget, {
options: {
theme: null,
+ mini: false,
initSelector: "input[type='checkbox'],input[type='radio']"
},
_create: function() {
var self = this,
input = this.element,
+ o = this.options,
inheritAttr = function( input, dataAttr ) {
return input.jqmData( dataAttr ) || input.closest( "form,fieldset" ).jqmData( dataAttr )
},
@@ -29,7 +31,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
parentLabel = $( input ).closest( "label" ),
label = parentLabel.length ? parentLabel : $( input ).closest( "form,fieldset,:jqmData(role='page'),:jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ),
inputtype = input[0].type,
- mini = inheritAttr( input, "mini" ),
+ mini = inheritAttr( input, "mini" ) || o.mini,
checkedState = inputtype + "-on",
uncheckedState = inputtype + "-off",
icon = input.parents( ":jqmData(type='horizontal')" ).length ? undefined : uncheckedState,
@@ -55,12 +57,12 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
});
// If there's no selected theme check the data attr
- if( !this.options.theme ) {
- this.options.theme = $.mobile.getInheritedTheme( this.element, "c" );
+ if ( !o.theme ) {
+ o.theme = $.mobile.getInheritedTheme( this.element, "c" );
}
label.buttonMarkup({
- theme: this.options.theme,
+ theme: o.theme,
icon: icon,
shadow: false,
mini: mini,

0 comments on commit 7f6c0ac

Please sign in to comment.
Something went wrong with that request. Please try again.