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

Commit e4f34b7

Browse files
author
Scott Jehl
committed
changed the check for table cell visibility to check if display === table-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
1 parent 1b7aa93 commit e4f34b7

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

js/widgets/jquery.mobile.table.columntoggle.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,7 @@ $( document ).delegate( ":jqmData(role='table')", "tablecreate", function() {
6565

6666
});
6767

68-
$menuButton
69-
.insertBefore( $table )
70-
.buttonMarkup({
71-
theme: o.columnBtnTheme
72-
});
73-
74-
$popup
75-
.insertBefore( $table )
76-
.popup();
68+
7769

7870
// bind change event listeners to inputs - TODO: move to a private method?
7971
$menu.on( "change", "input", function( e ){
@@ -85,21 +77,27 @@ $( document ).delegate( ":jqmData(role='table')", "tablecreate", function() {
8577
}
8678
} );
8779

80+
$menuButton
81+
.insertBefore( $table )
82+
.buttonMarkup({
83+
theme: o.columnBtnTheme
84+
});
8885

86+
$popup
87+
.insertBefore( $table )
88+
.popup();
8989

9090
// refresh method
9191
self.refresh = function(){
9292
$menu.find( "input" ).each( function(){
93-
this.checked = $( this ).jqmData( "cells" ).eq(0).is( ":visible" );
93+
this.checked = $( this ).jqmData( "cells" ).eq(0).css( "display" ) === "table-cell";
9494
$( this ).checkboxradio( "refresh" );
9595
} );
9696
};
9797

9898
$( window ).on( "throttledresize", self.refresh );
9999

100-
// TODO. Why is a stack unwind needed here?
101-
// Maybe because we're waiting on CSS to be applied before that :visible check above can work
102-
setTimeout( self.refresh, 0 );
100+
self.refresh();
103101

104102
});
105103

0 commit comments

Comments
 (0)