6 Replies Latest reply on Dec 3, 2007 12:42 PM by ntsiii

    Dynamic add rows and columns in DataGrid problem

    Flex-Issac Level 1
      Hi all,

      I have problem in datagrid, my application need to read a configuration file to generate datagrid layout, that include number of column and column's information. How can I add a new row in action script ? I found that in Help and Forums topic only allow hardcode column in the array object.

      My current code:

      var row:Object = new Object();
      row.Account = "ABC";
      row.Period = "2007/03";
      row.DC = "D";
      row.Amount = 4840.39;

      But it is not my target code method, I want to change the column name be variable.

      var row:Object = new Object();
      var col1:String = "Account";
      var col2:String = "Period";
      var col3:String = "DC";
      var col4:String = "Amount";
      row[col1] = "ABC";
      row[col2] = "2007/03";
      row[col3] = "D";
      row[col4] = 4840.39;

      I tried use this way to code, the datagrid only insert a blank row.

      Anyone has idea how to implement the above code style or similar style?