0
votes

I'm using Flash Builder 4.6 to create a schedule for the next 12 hours. The rows hold employees and the columns represent the hours. I want one GridItemRenderer that can be used by all cells to display the info appropriately.

I'm currently setting a GridItemRenderer in the GridColumn to try and accomplish this. I can get it to recognize data related to the row, but I can not get the renderer to recognize the column it is being applied to, so I can calculate if the current cell is between the start/end times for the current employee.

Any thoughts?

1
You should add some code. It is very hard to understand what you're trying to achieve. Nevertheless (if I understand you correctly) you should simply be able to loop through the dataProvider to find the data you need. - RIAstar
If I use the same itemrender for 2 cells ([0,1], [0,2]) in a datagrid, can my item renderer identify if its being applied by [0,1] or [0,2]? - eimmer

1 Answers

0
votes

use "column" property in your item renderer.

 override public function set data(value:Object):void {
    if( value != null ) {
      super.data = value;

      if( column.dataField == "col1" ) {
        myLabel.text = data.col1;
      } else {
        myLabel.text = data.col2;
      }
    }
  }

I find the answer from this:

Flex: get column index in custom itemrenderer for spark datagrid

and tested, it's ok.