Button: Added refresh method to buttonset, futher fixes #5278 - ui.buttons doesn't visually reset on form "reset" event or input "change" event

This commit is contained in:
Richard Worth 2010-03-17 13:07:46 +00:00
parent 124f84635f
commit 2a8271c701

View File

@ -312,19 +312,11 @@ $.widget( "ui.button", {
$.widget( "ui.buttonset", {
_create: function() {
this.element.addClass( "ui-button-set" );
this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
.button()
.map(function() {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-corner-all" )
.filter( ":first" )
.addClass( "ui-corner-left" )
.end()
.filter( ":last" )
.addClass( "ui-corner-right" )
.end()
.end();
this._init();
},
_init: function() {
this.refresh();
},
_setOption: function( key, value ) {
@ -334,6 +326,27 @@ $.widget( "ui.buttonset", {
$.Widget.prototype._setOption.apply( this, arguments );
},
refresh: function() {
this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
.filter( ":ui-button" )
.button( "refresh" )
.end()
.not( ":ui-button" )
.button()
.end()
.map(function() {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
.filter( ":first" )
.addClass( "ui-corner-left" )
.end()
.filter( ":last" )
.addClass( "ui-corner-right" )
.end()
.end();
},
destroy: function() {
this.element.removeClass( "ui-button-set" );