1 Reply Latest reply on Oct 15, 2009 6:23 AM by Subeesh Arakkan

    In DataGrid, how to fill one column's records with zeros (0)?

    lee704 Level 1

      Is there a simple way, in a DataGrid, to fill one column's records with zeros (0)?

       

      I have a DataGrid with two columns:  colA and colB.  The values of the colA records come from a RemoteObject call.  I need to auto-fill (auto-populate) the records in colB with zeros.  How can this be done?

       

      Thanks!

        • 1. Re: In DataGrid, how to fill one column's records with zeros (0)?
          Subeesh Arakkan Level 4

          If you need 0 in the dataprovider, once you get the result loop through the data provider and add dynamic property with value = 0;

           

          Something like this

          var dp:ArrayCollection = event.result as ArrayCollection;

           

          for(each var item:Object in dp)
          {
                 item.demoValue = 0;
          }

           

          create a new datagrid column, set demoValue as datafield.

           

          If it is just for display, add a new column, put an itemrenderer with label="0"