4 Replies Latest reply on Feb 15, 2007 2:07 PM by dimival

    Question on ItemRender

    dimival Level 1
      I was reading the documentation and i couldn't find an answer to this:

      ItemRenders use the data property to access values of the current item of a dataProvider, this way we use data.propertyName to access them.
      But what if i want to use a labelFunction instead? I mean, can an ItemRender use the return value of a LabelFunction?

      For example:
      Suppose the objects in a Datagrid.dataProvider contain a Number property (1,2,3,....) and we use a LabelFunction to display the numbers as text (one, two, three,...). That would be easy:

      public function numberAsText(item:Object, column:DataGridColumn) : String
      {
      if(item.num==1) return 'one';
      else if ( ) ...... //and so on
      }

      But what if instead of showing the number as a String we decide to show it as an Image (itemRender) containing the number?? Is it possible to use a LabelFunction to obtain the source of the image to display as an ItemRender?