Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Fixes #3529 - Added refresh method to collapsibleset widget
Browse files Browse the repository at this point in the history
  • Loading branch information
gseguin committed Feb 23, 2012
1 parent b4e0389 commit 60f20e0
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions js/jquery.mobile.collapsibleSet.js
Expand Up @@ -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 ) {
Expand All @@ -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 ) {
Expand All @@ -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" );
}
});

Expand Down

0 comments on commit 60f20e0

Please sign in to comment.