/* Flexigrid's height is for table's tbody only, it does not include the chrome's (grid's navigation panel, title bar, etc) height. So if you pass 250 to flexigrid's height parameter, and you pass the same 250 to resizeFgHeight, it will actually make the flexigrid smaller. */ function resizeFgHeight(tbl, newHeight) { grd = tbl.closest('.flexigrid'); var heightWithChromes = grd.height(); var contentHeight = $('.bDiv', grd).height(); var chromesHeight = heightWithChromes - contentHeight; $('.bDiv', grd).height(newHeight - chromesHeight); grd.css('height', newHeight); } // This height is the same as flexigrid's height parameter. // Flexigrid's height parameter describes the the tbody's height of the table only, // it does not include the chromes' heights function resizeFgContentHeight(tbl, newHeight) { grd = tbl.closest('.flexigrid'); $('.bDiv', grd).height(newHeight); }
To use
<table id="nav"></table> $(function() { $('#adjust').click(function() { resizeFgHeight($('#nav'), 480); }); });
No comments:
Post a Comment