This is probably an easy question for a CSS (or maybe a KoGrid) expert (which I am neither). The setting is a web page using Knockout and JQuery with one-to-many KoGrids. Only one is grid is "display:block" at a time. All the others are "display:hidden".
When a user resizes their browser window, the hidden grids get the widths of their kgTopPanel, kgViewport, and kgFooterPanel areas set to "0". Afterwards, when the user clicks a link to activate a previously hidden grid, it will not restore the widths and they must resize the browser window again to see things. After many long hours I figured out the hack below as a way to get around it but it is ugly.
Is there an elegant way to fix this without the hack? Can I prevent those widths from getting set to zero in the first place? I am not a CSS expert and I exhausted my knowledge long ago. I took a whole day searching the web, trying bunches of things, and ultimately found no answers.
In the code snippet below, "domPanel" is a div that contains ALL the grids. "domObject" is the one grid I want to switch on.
<div id='Grid1' data-bind="koGrid: g1.GridOptions"></div>
<div id='Grid2' data-bind="koGrid: g2.GridOptions"></div>
...
domTabPanel.children().css('display', 'none');
domObject.css('display', 'block');
// Hack to restore the widths. If you resize the page
// when another tab is visible, all the widths will have been set to 0.
domObject.find(".kgTopPanel").css("width", "inherit");
domObject.find(".kgTopPanel").children().css("width", "inherit");
domObject.find(".kgViewport").css("width", "inherit");
domObject.find(".kgViewport").children().css("width", "inherit");
domObject.find(".kgFooterPanel").css("width", "inherit");
domObject.find(".kgFooterPanel").children().css("width", "inherit");
PS: The problem appears under both IE and Chrome so I assume all browsers are probably affected.