Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes #3529 - Added refresh method to collapsibleset widget

  • Loading branch information...
commit 60f20e06e2ec6d64dec77947bfe50c2c8fb2690d 1 parent b4e0389
@gseguin gseguin authored
Showing with 33 additions and 25 deletions.
  1. +33 −25 js/jquery.mobile.collapsibleSet.js
View
58 js/jquery.mobile.collapsibleSet.js
@@ -12,8 +12,7 @@ $.widget( "mobile.collapsibleset", $.mobile.widget, {
},
_create: function() {
var $el = this.element.addClass( "ui-collapsible-set" ),
- o = this.options,
- collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" );
+ o = this.options;
// Inherit the theme from collapsible-set
if ( !o.theme ) {
@@ -26,7 +25,6 @@ $.widget( "mobile.collapsibleset", $.mobile.widget, {
// Initialize the collapsible set if it's not already initialized
if ( !$el.jqmData( "collapsiblebound" ) ) {
-
$el
.jqmData( "collapsiblebound", true )
.bind( "expand collapse", function( event ) {
@@ -47,32 +45,42 @@ $.widget( "mobile.collapsibleset", $.mobile.widget, {
.closest( ".ui-collapsible" )
.siblings( ".ui-collapsible" )
.trigger( "collapse" );
-
});
+ }
+ },
- // clean up borders
- collapsiblesInSet.each( function() {
- $( this ).find( $.mobile.collapsible.prototype.options.heading )
- .find( "a" ).first()
- .add( ".ui-btn-inner" )
- .removeClass( "ui-corner-top ui-corner-bottom" );
- });
+ _init: function() {
+ this.refresh();
+ },
- collapsiblesInSet.first()
- .find( "a" )
- .first()
- .addClass( "ui-corner-top" )
- .find( ".ui-btn-inner" )
- .addClass( "ui-corner-top" );
+ refresh: function() {
+ var $el = this.element,
+ collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" );
- collapsiblesInSet.last()
- .jqmData( "collapsible-last", true )
- .find( "a" )
- .first()
- .addClass( "ui-corner-bottom" )
- .find( ".ui-btn-inner" )
- .addClass( "ui-corner-bottom" );
- }
+ $.mobile.collapsible.prototype.enhance( collapsiblesInSet );
+
+ // clean up borders
+ collapsiblesInSet.each( function() {
+ $( this ).find( $.mobile.collapsible.prototype.options.heading )
+ .find( "a" ).first()
+ .add( ".ui-btn-inner" )
+ .removeClass( "ui-corner-top ui-corner-bottom" );
+ });
+
+ collapsiblesInSet.first()
+ .find( "a" )
+ .first()
+ .addClass( "ui-corner-top" )
+ .find( ".ui-btn-inner" )
+ .addClass( "ui-corner-top" );
+
+ collapsiblesInSet.last()
+ .jqmData( "collapsible-last", true )
+ .find( "a" )
+ .first()
+ .addClass( "ui-corner-bottom" )
+ .find( ".ui-btn-inner" )
+ .addClass( "ui-corner-bottom" );
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.