PDA

View Full Version : Problem with creating buttons within hidden element



philf
9 Jan 2007, 8:50 PM
I am using yui-ext 0.33, and am using ext.Button.add() to create some buttons. Because of my ajax handling, sometimes I need to render the buttons into a hidden (display:none) div, and then use them when the div is shown.

There is a problem in Firefox with this process (OK in IE). The button.add code runs an autoWidth call, which does a call to getWidth. getWidth returns dom.offsetWidth, which returns zero when inside a hidden element. This in turn causes the addWidth code in the button setup to set the button "A" element to zero width.

Been thinking about a fix, but not sure what it is just yet. Ideas / help welcomed.

pmf

tryanDLS
9 Jan 2007, 9:25 PM
Try using visibility:hidden instead of display:none. There are a number of threads about how display:none causes problems with positioning/size calcs.