1 Reply Latest reply on Aug 12, 2007 11:00 PM by Ruben Ramirez

    DataGrid: data driven datagrid column headers

    Ruben Ramirez
      I have a datagrid that I would like to populate the datagridcolumn headers with specific data at runtime.

      I'm going through the array of data objects and creating each column but I still need to figure out how to set the header for each one. I tried setting the itemRenderer for the column to a simple lable component but then I don't know how to set the text of this label to the correct datadriven objects say name field.

      Any help would be greatly appreciated,
      Ruben
        • 1. Re: DataGrid: data driven datagrid column headers
          Ruben Ramirez Level 1
          I figured this out. Basically before you set the headerRenderer you get your component and wrap it around a ClassFactory object and then set the property you want to appear in the header. You can do this in a loop and change the header as you go. Here is some code that might go in a loop:

          var lblFact:ClassFactory=new ClassFactory(Label);
          lblFact.properties={text:"changing text data"};
          dgColumn.headerRenderer=lblFact;

          Maybe this will help someone later on.