6 Replies Latest reply on Dec 5, 2011 8:39 AM by DonMitchinson

    Flex evaluate string for dynamic datagrid headerText


      Hello:  I m new to Flex and am creating headerText for a datagrid (dgTop250). How do I get the variable headerStr to evaluate correctly in the last line of the function? With the code below I get the entire string as the column header in the datagrid, not the evaluated expression that I need. Variable headerStr is evaluating correctly, I just need it to get evaluated in the headerText statement.. I know the eval function isn't available in AS3.


      public function get250(event:ResultEvent):void {
        (var i:int = 0; i <= dgTop250.columnCount; i++) {
      var colName:String=dgTop250.columns[i].dataField;
      var headerStr:String="top250.lastResult.IMS001HQ2.SGM.getItemAt(i)."+colName+".label";
      (dgTop250.columns[i] as DataGridColumn).headerText = headerStr;

      As an example, this is what I'm getting as the header: top250.lastResult.IMS001HQ2.SGM.getItemAt(i).STOCK.label

      This is what I need: Stock Number

      "Stock Number" is the label for STOCK.