1 Reply Latest reply on Mar 23, 2007 11:19 AM by michael_ramirez44

    Call function in itemRenderer component?

    JamieMason
      I'm doing this exercise to help me with learning flex and have been using parts of Example: modifying data in DataGrid control from Live Docs.

      I want to be able to alter the appearance of specific DataGrid cells whose data has changed and am struggling a lot with it.

      The code is much the same as that example, but I have created a component as an itemRenderer for the first name column, linked as follows;

      <mx:DataGridColumn headerText="Some Title" itemRenderer="cpnts.irender"/>

      The code for this component is;

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:Script>
      <![CDATA[
      public function testFn():void{
      this.setStyle('backgroundColor','#BBBBCC')
      }
      ]]>
      </mx:Script>
      <mx:Label text="{data.first}"/>
      </mx:HBox>

      in any hard coded form for now, how could I call the testFn() function in the first cell in the table, from the Application?

      What I'm working towards is a DataGrid used with data which changes live, each data cell would go green or red depending on if the value increased or decreased for example.

      Thanks in advance, please also let me know if this is wrong approach for doing this. Should I maybe be handling and comparing changed data in my ArrayCollection and setting other properties accordingly? eg: @change[none|higher|lower] then re-populating the DataGrid and setting display properties for each cell according to that value?

      Thanks again, (I hope I'm making sense by the way, I'm a bit low on sleep!)


      Jamie Mason