1 Reply Latest reply on Sep 16, 2009 7:21 AM by ric_bia

    Datagrid text style inside cell

    ric_bia

      I'm using a datagrid to display a array of objects.

       

      Is it possible to change the style  of a text (bold / italic) inside a single cell of a row?

        • 1. Re: Datagrid text style inside cell
          ric_bia Level 1

          I've found a solution writing a custom itemRenderer for the dataGridColumn that needs the style change:

          package renderers
          {
              import mx.controls.Label;
              
              public class MY_CLASS_NAME extends Label
              {
                  // change to bold
                  override protected function updateDisplayList(width:Number, height:Number):void
                  {
                      super.updateDisplayList(width, height);
                      
                      setStyle("fontWeight", ((data.FIELD_OF_MY_ARRAY == '1') ? "bold" : "normal"));
                  }
              }
          }