2 Replies Latest reply: Mar 25, 2011 5:50 AM by MrKoinkoin RSS

    Cairngorm Observer : Could we use a itemRendererFunction ?

    MrKoinkoin

      Hi,

       

      I've got a special need for my application : I should use several renderer depending on data state/type.

       

      It seems that this need could be covered by itemRendererFunction (in a spark list for example) but this property does not exist in Cairngorm Observer SelectableChildProvider type.

       

      Is there a way to use itemRendererFunction or a trick/tip to use something similar ?

       

      Thx

       

      Cédric

        • 1. Re: Cairngorm Observer : Could we use a itemRendererFunction ?
          Nicolas Yuen Adobe Employee

          Hi Cedric,

           

          The ChildProvider re-uses created itemRenderers a bit like the Spark List with virtualLayout enabled ( virtualLayout is not supported when using itemRenderer functions for the same reason). As such adding an itemRendererFunction would involve loosing this UIComponent "caching" feature for this specific case.

           

          If you fill that this feature is important could you please create an enhancement request on our JIRA?

           

          https://bugs.adobe.com/jira/browse/CGM

           

          As a temporary workaround you can rely on states to rearrange the layout of your renderers based on the data property. You may also be interested in the classFactory feature to pass properties to your itemRenderers (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/ClassFactory.ht ml)

           

          Many thanks,

           

          Nicolas

          • 2. Re: Cairngorm Observer : Could we use a itemRendererFunction ?
            MrKoinkoin Community Member

            Hi Nicolas,

             

            In fact using state on the renderer component is more or less what I've already done (I make the "switch" to "add" the desire component to display versus the "data" property type given by the Observer).

             

            But what I don't like is the two possible components are instanciated at start untill the test is done and switch from the right one to be displayed.

             

            As you told me it seems it's not the purpose f the Observer business to do what I want. I will extend TabNavigator in order to manage my request (eg. the first Tab is my "search tab with filter and datagrid which when clicked on a row add a new Person Tab managed by the Observer")

             

            Thx anyway Nicolas

             

            Regards

             

            Cédric