3 Replies Latest reply on May 19, 2011 11:01 AM by 5Systems

    Update one row at a time, Data Grid

    5Systems Level 1

      Is it possible to update one row of a mx:DataGrid at a time.  I want to be able to have a user push a button and info populates one row of the data grid, user changes some properties and pushes the button again and another row of values populate the DataGrid.  Everything I see does a mass population from an XML or what have you.

       

      Thanks

        • 1. Re: Update one row at a time, Data Grid
          brendalc1636

          I haven't looked around or put much thought into this but the thing that pops in my mind is to have two arraycollections. Have one arraycollection with the whole collection. The second one can start with the first thing in the whole collection. Then as you click your button add the next item to the second array collection from the whole collection.

           

          Brenda

          1 person found this helpful
          • 2. Re: Update one row at a time, Data Grid
            5Systems Level 1

            I found a post that talks about using the addItem() method of the Array collection object, I makes sense now that I see it, I am going to give that a try.

             

            Thanks,

            • 3. Re: Update one row at a time, Data Grid
              5Systems Level 1

              I did this this to work, so for those of you who may find this info helpfull here is how I solved the issue.

               

              I instantiated an ArrayCollection object like so:

              private var _rowValues:ArrayCollection = new ArrayCollection(); 
              

               

              I simply referenced the .addItem() property of my ArrayCollection.

               

              I then added values to the ArrayCollection as follows

              _rowValues.addItem({Ingredient:ingredient, Amount:amount, Category:category}); //dataField:value
              

               

              and referenced the dataField proerpty of the DataGrid... so in my case my 3 dataField properties (in my mxml compontent) were as fillows:

              dataField="Ingredient"
              dataField="Amount"
              dataField="Category"
              

               

              all done, and it works.