ojintoad
09-21-2006, 01:36 PM
I am just posting this in case anyone else has a similar issue.
In the implementation of the YAHOO.ext.Element, there are two choices for how element Visibility is managed: using the Visibility style property or the Display style property. You can select which property gets changed by the classes' methods by calling the YAHOO.ext.Element.setVisibilityMode method with either of the two constants YAHOO.ext.Element.DISPLAY or YAHOO.ext.Element.VISIBILITY.
Visiblity is an easy style property to handle since it just toggles between the visible and hidden values. However, if you choose to use the Display property, the class has to determine what possible Display property values you want to use (block, inline, inline-block, etc.). To handle this, it detects the initial display property of your element at object creation time, rather than assume you want all your items displayed as either block or inline elements.
But what if you want your elements want to start out with display of none? You go to your style sheet, write "display:none" , use getEl to get your element, and call .show, but nothing shows up! Well, the methods to toggle visibilty actually use the initial display property when showing the element, so show is setting your element's display to none, just like it should.
To work around this, all you need to do is use your CSS to show elements using whichever display style property you want, then write a page load event function to hide all the elements using the YAHOO.ext.Element functions.
The additional benefit of this is the YAHOO.ext.Element class automagically caches each element to prevent lookups later.
Alternately, you can avoid all this by using the Visibility Mode and visibility style property.
In the implementation of the YAHOO.ext.Element, there are two choices for how element Visibility is managed: using the Visibility style property or the Display style property. You can select which property gets changed by the classes' methods by calling the YAHOO.ext.Element.setVisibilityMode method with either of the two constants YAHOO.ext.Element.DISPLAY or YAHOO.ext.Element.VISIBILITY.
Visiblity is an easy style property to handle since it just toggles between the visible and hidden values. However, if you choose to use the Display property, the class has to determine what possible Display property values you want to use (block, inline, inline-block, etc.). To handle this, it detects the initial display property of your element at object creation time, rather than assume you want all your items displayed as either block or inline elements.
But what if you want your elements want to start out with display of none? You go to your style sheet, write "display:none" , use getEl to get your element, and call .show, but nothing shows up! Well, the methods to toggle visibilty actually use the initial display property when showing the element, so show is setting your element's display to none, just like it should.
To work around this, all you need to do is use your CSS to show elements using whichever display style property you want, then write a page load event function to hide all the elements using the YAHOO.ext.Element functions.
The additional benefit of this is the YAHOO.ext.Element class automagically caches each element to prevent lookups later.
Alternately, you can avoid all this by using the Visibility Mode and visibility style property.