1 Reply Latest reply on Aug 24, 2009 8:56 AM by paul.williams

    how to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..

    nagasreekrishna

      iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap

        • 1. Re: how to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..
          paul.williams Level 4

          A DataGrid is row-based rather than cell-based with each row

          corresponding to an item in an underlying collection (specified in the

          dataProvider property). In order to add data to a DataGrid you

          manipulate the underlying collection, rather than the grid directly.

          Based on the limited description of your problem I would imagine you

          would need to create dynamic objects with property names that correspond

          to the dataFields of your dynamically created datagrid columns.

           

          So if you had created columns with dataFields "alpha", "beta" and

          "gamma" on your datagrid, you could create an item in your grid by

          adding the following object to your dataProvider:

           

          var gridItem : Object = new Object();

          gridItem.alpha = "alphaValue";

          gridItem.beta = "betaValue";

          gridItem.gamma = "gammaValue";