diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-12 11:24:30 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-10-08 14:02:47 -0400 |
commit | 6c1390dc0d3c4f9f24196adf3aeba5a0566866e7 (patch) | |
tree | 6c5cf81a829ce627a9f423ce2b513bb3d935bb93 /ui | |
parent | 77be50d7a65cc5d139f212906463ab97a0cc8689 (diff) | |
download | jquery-ui-6c1390dc0d3c4f9f24196adf3aeba5a0566866e7.tar.gz jquery-ui-6c1390dc0d3c4f9f24196adf3aeba5a0566866e7.zip |
Controlgroup: Add controlgroup labels
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/controlgroup.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ui/widgets/controlgroup.js b/ui/widgets/controlgroup.js index 83cb184ec..3887c7abf 100644 --- a/ui/widgets/controlgroup.js +++ b/ui/widgets/controlgroup.js @@ -39,7 +39,8 @@ return $.widget( "ui.controlgroup", { "button": "input[type=button], input[type=submit], input[type=reset], button, a", "checkboxradio": "input[type='checkbox'], input[type='radio']", "selectmenu": "select", - "spinner": ".ui-spinner-input" + "spinner": ".ui-spinner-input", + "controlgroupLabel": ".ui-controlgroup-label" }, direction: "horizontal", excludeInvisible: true @@ -67,7 +68,7 @@ return $.widget( "ui.controlgroup", { // First we iterate over each of the items options $.each( this.options.items, function( widget, selector ) { - var widgets, + var widgets, labels, options = {}; // We assume everything is in the middle to start because we can't determine @@ -94,17 +95,22 @@ return $.widget( "ui.controlgroup", { childWidgets.push( widgetElement[ 0 ] ); } ); + } else if ( selector && widget === "controlgroupLabel" ) { + labels = that.element.find( selector ); + that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); + Array.prototype.push.apply( childWidgets, labels ); } } ); this.childWidgets = $( $.unique( childWidgets ) ); + this._addClass( this.childWidgets, "ui-controlgroup-item" ); }, _callChildMethod: function( method ) { this.childWidgets.each( function() { var element = $( this ), data = element.data( "ui-controlgroup-data" ); - if( data[ method ] ) { + if( data && data[ method ] ) { data[ method ](); } } ); @@ -203,7 +209,7 @@ return $.widget( "ui.controlgroup", { // before determining first and last $.each( [ "first", "last" ], function( index, value ) { var instance = children[ value ]().data( "ui-controlgroup-data" ); - console.log( instance ) + if ( that[ "_" + instance.widgetName + "_options" ] ) { instance.element[ instance.widgetName ]( that[ "_" + instance.widgetName + "_options" ]( |