]> source.dussan.org Git - jquery-ui.git/commitdiff
Button: Added refresh method to buttonset, futher fixes #5278 - ui.buttons doesn...
authorRichard Worth <rdworth@gmail.com>
Wed, 17 Mar 2010 13:07:46 +0000 (13:07 +0000)
committerRichard Worth <rdworth@gmail.com>
Wed, 17 Mar 2010 13:07:46 +0000 (13:07 +0000)
ui/jquery.ui.button.js

index bb9aa4802bede1218126d3dcb715a17214c41bd1..be0af7ecdde4bf01d672bd4e63fdfba134aa44bb 100644 (file)
@@ -312,12 +312,33 @@ $.widget( "ui.button", {
 $.widget( "ui.buttonset", {
        _create: function() {
                this.element.addClass( "ui-button-set" );
+               this._init();
+       },
+       
+       _init: function() {
+               this.refresh();
+       },
+
+       _setOption: function( key, value ) {
+               if ( key === "disabled" ) {
+                       this.buttons.button( "option", key, value );
+               }
+
+               $.Widget.prototype._setOption.apply( this, arguments );
+       },
+       
+       refresh: function() {
                this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
-                       .button()
+                       .filter( ":ui-button" )
+                               .button( "refresh" )
+                       .end()
+                       .not( ":ui-button" )
+                               .button()
+                       .end()
                        .map(function() {
                                return $( this ).button( "widget" )[ 0 ];
                        })
-                               .removeClass( "ui-corner-all" )
+                               .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
                                .filter( ":first" )
                                        .addClass( "ui-corner-left" )
                                .end()
@@ -327,14 +348,6 @@ $.widget( "ui.buttonset", {
                        .end();
        },
 
-       _setOption: function( key, value ) {
-               if ( key === "disabled" ) {
-                       this.buttons.button( "option", key, value );
-               }
-
-               $.Widget.prototype._setOption.apply( this, arguments );
-       },
-
        destroy: function() {
                this.element.removeClass( "ui-button-set" );
                this.buttons