1 Reply Latest reply on Jul 6, 2009 2:10 PM by deepa subramaniam (adobe)

    Extending Spark List, can't access "listItems"?


      We're trying to use listItems to expose the instances of a List's itemRenderer class. Is their a spark equivalent to "listItems"? In Flex 3 you used to be able to access listItems if you extended the List component. Using a spark List in the same manor throws an error stating that it is an undefined property. Working Flex 3 example:


      package com.test
          import mx.controls.List;
          public class RendererList extends List
              public function get renderers():Array
                  return listItems;
        • 1. Re: Extending Spark List, can't access "listItems"?
          deepa subramaniam (adobe) Level 2

          Hello -


          The goal of Spark and the Gumbo release of Flex is to modularize functionality in such a way that composite parts "own" functionality and these pieces can be layered together to build complex components.

          As such, the Spark List differs from the Halo List in many ways. The Spark List delegates to the DataGroup part for the creation and management of item renderers. It delegates to the Layout object the layout of these renderers. The Spark List.as and ListBase.as classes basically manage only single and multiple selection and basic keyboard handling.


          So, for what you are requesting (access to the renderers for the data items in a Spark List) you would go through the Spark DataGroup. The easiest would be to lookup individual renderers based on data item index via DataGroup.getElementAt() or DataGroup.getVirtualElementAt(). There is no accessible data structure storing all of the created renderers available. If you feel the need for that (vs accessing the renderers yourself via the DataGroup APIs) can you please file an ECR in Jira?


          Deepa Subramaniam

          Flex SDK Engineer