Friday, May 9, 2008

Accordion with non responding headers


I came across a peculiar requirement:- An accordion with non responding headers if the container is empty.

I extended the Accordion class and did an override of the set selectedIndex method...This is where the index is set and an event is dispatched.
I ran into trouble when I could not access children of another container within the same component. It always returned me 0 children. The solution being setting creationPolicy="all" this would force the accordion to draw all children during the initial phases. Else it defers this until the component is accessed.

Another problem I encountered was that first time set selectedIndex always get the numChildren as 0. This has been tackled by setting a dirtyFlag for the first time.

The example is here (view source enabled)

Do drop a comment if you find this useful or think it could have been done in a better way.

1 comments:

Murray said...

Thanks Aasim, this was most helpful. We experienced the problem exactly as you described it and have been scratching our heads. Good catch!