4 Replies Latest reply on Dec 13, 2007 4:37 AM by msnelsonUK

    Item renderer for data grid

    msnelsonUK
      Hi,

      I have a data grid and I would like to create an item renderer that will colour the cell based on the cell contents. For example all cells that contain the letter 'E' will be green, the letter 'L' will be red, the letter 'DO' will be yellow, etc.

      I create the grid dynamically in my script file:

      LOOP i

      newColumn = new DataGridColumn();
      newColumn.dataField = addDaysToDate(i, _firstDay);
      newColumn.headerText = (_firstDay.date + i).toString() + "/" + (_firstDay.month + 1).toString();
      newColumn.itemRenderer = new ClassFactory(itemRenderers.component.gridItemRenderer);

      //add the series to the column series array: columnSeries
      columnSeries = grid.columns;
      columnSeries.push(newColumn);
      grid.columns = columnSeries;

      END LOOP

      My dataProvider is an object that contains (umong other attributes) an array of key/value pairs: [date][letter]

      In my gridItemRenderer I want to capture what data is to be set in the cell and change the cell's background colour accordingly.

      Is this possible?

      Many thanks in advance,

      Janie