4 Replies Latest reply on Dec 7, 2007 7:39 AM by yevster

    ItemRenderer problem

    yevster
      I have this simple inline ItemRenderer that is supposed to get a value from a function. However, the function return value does not get displayed... whereas localVar does. Any ideas?

      <mx:DataGridColumn headerText="Checklist Completeness" headerWordWrap="true" width="570" >
      <mx:itemRenderer >
      <mx:Component>
      <mx:VBox width="100%" height="50" horizontalAlign="center" verticalAlign="middle">
      <mx:Label text="{outerDocument.localVar}" />
      <mx:Label text="{outerDocument.localFunc()}" />
      </mx:VBox>
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
        • 1. Re: ItemRenderer problem
          ntsiii Level 3
          There is no value being passed into the function to tell flex when to execute the binding. Not sure of a solution, but you could try passing in "data" even if you don't use it.
          Tracy
          • 2. Re: ItemRenderer problem
            Gregory Lafrance Level 6
            You are binding the Label text to a function but that does not mean the function will be executed. So just create a bindable variable and have the function called at application creationComplete, which will populate the bindable variable.
            • 3. Re: ItemRenderer problem
              yevster Level 1
              I was hoping to generate URL's on the fly and use for fetching images from my database. I will try sending a parameter in, that is what i need to do anyway. The function will return a URL with parameters appended: ?imageId=ABC99383&width=100&height=100. ABC99383 will come from dataprovider of Datagrid.

              Lots of pot holes to go around in Flex, or is it my inexperience?
              • 4. Re: ItemRenderer problem
                yevster Level 1
                Yep that worked:

                <mx:DataGridColumn
                <mx:itemRenderer >
                <mx:Component>
                <mx:Image source="{outerDocument.barURL(data.@checkListCount, data.@completeCount)}" />
                </mx:Component>
                </mx:itemRenderer>
                </mx:DataGridColumn>