Permalink
Browse files

[checkboxradio] Adding new behaviour to widget definition

  • Loading branch information...
1 parent 0f212b3 commit 0de97f3cc140521a640d4199ac91e2fa3744c2fa @gabrielschulhof gabrielschulhof committed Oct 23, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 js/widgets/forms/checkboxradio.js
@@ -9,7 +9,7 @@
//>>css.structure: ../css/structure/jquery.mobile.forms.checkboxradio.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
-define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "../../jquery.mobile.buttonMarkup" ], function( $ ) {
+define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "../../jquery.mobile.buttonMarkup", "./reset" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
@@ -138,6 +138,9 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
});
+ if ( this._handleFormReset ) {
+ this._handleFormReset();
+ }
this.refresh();
},
@@ -170,6 +173,10 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
.checkboxradio( "refresh" );
},
+ _reset: function() {
+ this.refresh();
+ },
+
refresh: function() {
var input = this.element[0],
label = this.label,
@@ -199,6 +206,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
});
+$.widget( "mobile.checkboxradio", $.mobile.checkboxradio, $.mobile.behaviors.formReset );
+
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
$.mobile.checkboxradio.prototype.enhanceWithin( e.target, true );

0 comments on commit 0de97f3

Please sign in to comment.