3 Replies Latest reply on Mar 13, 2008 3:04 PM by alexales

    Datagrid itemrenderer

    alexales
      Is there a way to embed in some way the itemrenderer. For example I have set up a datagird inside an other datagrid and when i have a lot of rows and when some of the renderers disappear and have a selected item, when they reappear they don't have a selected item.Or if i have an itemrenderer in which i want to display an image and the source of the image is taken from the data property of the renderer the image is redrawn. What does the renderers do when they disappear and reappear(if i call the initialize property of the component which is set up as a itemrenderer it doesn't call when they reappear,only when they are created for the first time)?
        • 1. Re: Datagrid itemrenderer
          ntsiii Level 3
          itemRenderes are recycled. Only the visible items and a few for buffering, are ever created. When the data changes, or when you scroll, the framework sets the "data" property on every renderer, so it gets a new dataProvider item. The renderer must then use that data itm to update is visible ui. Best practice is to use the invalidateProperties() and commitProperties() appraoch.

          The creation events, like initialize and creationComplete are only caled once, when the renderer is first created, and never again.

          Thus, ALL DYNAMIC CHARACTERISTICS OF A RENDER MUST BE DATA-DRIVEN.

          Advice: DO NOT START FROM SCRATCH. find an example renderer and modify it to suit your needs. There are very many examples available.

          Tracy
          • 2. Re: Datagrid itemrenderer
            alexales Level 1
            ntsii,you are very helpful(again).Thanks. I'll try what you said.
            • 3. Re: Datagrid itemrenderer
              alexales Level 1
              I tried to find how invalidateProperties() and commitProperties() approach work but didn't understand how i can make use of it in my case.But I read again what you said about how the renderer calls the set data property every time it is created and...voilla!!!! I overided the set data property and added some code about what to select when it is called(utilizing a singleton), so the problem with the selectedindex being changed is now solved.