Bug: Problems with Accordion and the ‘show’ event

This bug (SDK-11344) was brought up internally and investigated by my co-worker Kishan Venkataramana. The views in an Accordion don’t trigger the “show” event the first time they load. The workaround is to set creationPolicy=”all” on the Accordion. Now the “show” event will trigger the first time you load an Accordion view for all views except the first one. If you need some functionality triggered when the Accordion first loads with its first view, I would just call a function on the creationComplete handler as well as the show event. Here is a simple example:

<mx:Accordion width="300" height="250" creationPolicy="all">
    <mx:Canvas show="someFunc(..)" creationComplete="someFunc(..)">
        <mx:Label text="one"/>
    </mx:Canvas>
    <mx:Canvas show="someFunc(..)">
        <mx:Label text="two"/>
    </mx:Canvas>
</mx:Accordion>

5 responses

  1. Thanks for that πŸ™‚ been trying to figure out all evening why my function wasn’t executing on the first show event but would work every time after that creationPolicy=”all” worked a treat πŸ™‚

  2. Thanks for this.

    It was driving me crazy.

  3. thankyou so much. this piece saved my day

  4. You are from heaven. I spent hours trying to understand why the item renderer for the topmost accordion box was the only one that would display. The second box displayed the name of the data object, while the rest displayed nothing at all. Thought it was my data model so i rebuilt that. No luck. Can’t believe it was this simple…

  5. I spent couple of hours trying to figure out why I couldn’t access my datagrid within an accordion! Thanks, this just saved me so much time and effort.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: