Permalink
Browse files

changed the check for table cell visibility to check if display === t…

…able-cell, because this is happening before pageshow and the :visible check will always be false. Now the columntoggle menu is updated properly at init. addresses issue #5093
  • Loading branch information...
Scott Jehl
Scott Jehl committed Nov 2, 2012
1 parent 1b7aa93 commit e4f34b7d556f5e8c1c01cb282b01af65bf259f60
Showing with 11 additions and 13 deletions.
  1. +11 −13 js/widgets/jquery.mobile.table.columntoggle.js
@@ -65,15 +65,7 @@ $( document ).delegate( ":jqmData(role='table')", "tablecreate", function() {
});
$menuButton
.insertBefore( $table )
.buttonMarkup({
theme: o.columnBtnTheme
});
$popup
.insertBefore( $table )
.popup();
// bind change event listeners to inputs - TODO: move to a private method?
$menu.on( "change", "input", function( e ){
@@ -85,21 +77,27 @@ $( document ).delegate( ":jqmData(role='table')", "tablecreate", function() {
}
} );
$menuButton
.insertBefore( $table )
.buttonMarkup({
theme: o.columnBtnTheme
});
$popup
.insertBefore( $table )
.popup();
// refresh method
self.refresh = function(){
$menu.find( "input" ).each( function(){
this.checked = $( this ).jqmData( "cells" ).eq(0).is( ":visible" );
this.checked = $( this ).jqmData( "cells" ).eq(0).css( "display" ) === "table-cell";
$( this ).checkboxradio( "refresh" );
} );
};
$( window ).on( "throttledresize", self.refresh );
// TODO. Why is a stack unwind needed here?
// Maybe because we're waiting on CSS to be applied before that :visible check above can work
setTimeout( self.refresh, 0 );
self.refresh();
});

0 comments on commit e4f34b7

Please sign in to comment.