Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7773447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:08:11+00:00 2026-06-01T17:08:11+00:00

this problem has driven me crazy and I really need you guys help. I

  • 0

this problem has driven me crazy and I really need you guys help.

I have a datagrid showing data that is queried from mysql. I am trying to add a new row to my datagrid if the users add new record to the database. In other words, I want datagrid to reflect the uploaded data in the database. The datagrid seems to work ONLY on the first record I added. If I try to add a second record, the new row will be added but it ALSO change the first row to the newly updated record. I know it’s a bit hard to understand so I draw a picture here.

DATAGRID

id   name     number
1    test1     111
2    test2     222

Lets say I add a new record and the datagrid will be

id   name     number
1    test1     111
2    test2     222
3    test3     333  //new record, works fine.

but if I add another record, it will become

id   name     number
1    test1     111
2    test2     222
4    test4     444  //old record, the values change to the newest record.
4    test4     444  //new record, but also change the previous record

If I add another record again, it will become

id   name     number
1    test1     111
2    test2     222
5    test5     555  //first record, the values change to the newest record.
5    test5     555  //second record, the values change to the newest record.
5    test5     555  //newest record, change the previous 2 records

I have done anything I could think of to debug but still no luck.
The following are my codes:

// my php data service
<s:CallResponder id="addResult" result="addResult_resultHandler(event)" />

<script>

        //The handler after the user click ADD button

        protected function addBtn_clickHandler(event:MouseEvent):void
            {
                var newData:object = new Object();  
                newData.test1=formField1.text;
                newData.test2=formField2.text;
                newData.test3=formField3.text;
                newData.test4=formField4.text;


                            addResult.token=Service.createJob(newData);



            }





  //the result handler for data service. 
        protected function addResult_resultHandler(event:ResultEvent):void
                {
                           //jobData is my dataProvider in my datagrid component 
                          //not sure why addItem() would mess me up so badly...
                           //newData is an Object created after user click the update    
                           //button

                           jobDG.jobData.addItem(newData);          
                }


    Mxml

    <components:dataGridPanel  id="jobDG"
                               jobData="{getJobsResult.lastResult}"/>


    My datagrid component

    mxml
        <s:DataGrid id="dg" editable="true" x="5" y="3" width="734" height="253">
            <s:columns>
              <s:ArrayList>

                <s:GridColumn dataField="test1" headerText="text1">      
                            </s:GridColumn>
                <s:GridColumn dataField="test2" headerText="text2">            
                            </s:GridColumn>
                <s:GridColumn dataField="test3" headerText="text3">  
                            </s:GridColumn>
                <s:GridColumn dataField="test4" headerText="text4">  
                            </s:GridColumn>
               </s:ArrayList>
            </s:columns>
            <s:typicalItem>
            <fx:Object text1="aaaaa" text2="bbbbb" text3="ccccc" text4="dddddd">  
                     </fx:Object>
            </s:typicalItem>
             <s:AsyncListView list="{jobData}" />
        </s:DataGrid>

I am really desperate now. Any helps would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:08:12+00:00Added an answer on June 1, 2026 at 5:08 pm

    I agree with the other commenters that your posted code is unlikely to be what you’re actually using, but I think it does show the seeds of what your problem is. I think you have an instance variable called newData that you instantiate at the top of your Class, rather than in the addBtn_clickHandler function.

    The first time it works, because you’ve never added it to the collection before. When you click the button again, I suspect you’re simply changing the properties on the same object, then adding it to the collection in your result handler (rather than looking at the event’s data to get the new object that has been returned from the database).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem has driven me crazy, it's been 5 days I'm trying to solve
This problem has been kicking my butt for a few days now. I have
This problem has bugged me so many times and i have now decided to
I have this problem that I cannot fix. From my @Controller , i can
Very strange problem with my iPhone App. We have an App that has been
This problem has driven me mad for over a day now. I can create
I have a legacy (solve this problem for us issue) app that communicates with
This problem has been solved thanks to your suggestions. See the bottom for details.
This problem has happened to me twice.Both times during programming with Borland C++.when i
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.