PDA

View Full Version : setAutoWidth(true) Doesn't work on IE 8 or Chrome 5



ccocco_dw
26 Jul 2010, 10:02 AM
When creating a Window using GXT, setAutoWidth(true) should render the width of the Window to be the width of the contained components, including borders, paddings, margins, etc... This works correctly with FF 3.6 but not with IE 8 or Chrome 5, as the width in those cases is rendered to be the width of the monitor. Is this a known issue? I've tried overriding onAttach() and setting the width explicitly using a calculation but I cannot find a reliable way to get the true width on both browers.




protected void onAttach()
{
super.onAttach();



if (GXT.isIE || GXT.isChrome)
{
setWidth(myPanel.getWidth() + getFrameWidth()); // myPanel is created elsewhere...


}
}

sven
26 Jul 2010, 10:03 AM
setting autoWidth to true let the browser handle the width. As you found out, this is not working crossbrowser.

This means you should never use it if you dont need it. You should always use the layoutsystem are calculate the correct sizes.

ccocco_dw
27 Jul 2010, 5:27 AM
Hi, what purpose would this API serve if it doesn't work consistently across browers? Could you give me some insight into the usage of it? It only seems to work correctly with FireFox.

With respect to explicitly setting the floating window width, there doesn't seem to be a reliable way to get consistent inner component widths to calculate the total width when running in IE and Chrome, at least when retrieving them from the onAttach() method. I get different results in different browsers. Is there a more appropriate method to override?

sven
27 Jul 2010, 5:30 AM
Hi, what purpose would this API serve if it doesn't work consistently across browers? Could you give me some insight into the usage of it? It only seems to work correctly with FireFox.

There are cases where it can be used. I would like to remove it, but we cannot due to backward compatiblity.