8 Replies Latest reply on Jan 12, 2012 11:37 PM by jomor21

    DataGrid duplicate record




      I add record(from php) to a datagrid


      With :

      createArticulosResult.token = articulosService.createArticulos (items);


      But give me duplicate record in the datagrid


      I've tried everything, including calling back into service and load the dataProvider etc., but nothing.


      getAllArticulosResult.token = articulosService.getAllArticulos();



      Anyone know how to reload or refresh a datagrid to avoid duplicates.




        • 1. Re: DataGrid duplicate record
          pauland Level 4

          Yes, stop your PHP service from supplying duplicates.

          • 2. Re: DataGrid duplicate record
            jomor21 Level 1

            And how I can stop the service?



            • 3. Re: DataGrid duplicate record
              senthil s Level 1

              Refresh the getArticulosByNameResult.lastResult;   getArticulosByNameResult.lastResult.refresh(); then Datagrid id.validateNow();  it ill work check it.

              1 person found this helpful
              • 4. Re: DataGrid duplicate record
                jomor21 Level 1

                Senthil s Oh, I thought that was the solution, but failed to work well:

                For example:

                I have the item48, but I add the item49 and puts me over 48 go out and enter the application and everything is fine is like one who update instead of add, but has sincecreateArticulosResult.token

                It's like the dataGrid not possible to extend one more. Crush the above.



                • 5. Re: DataGrid duplicate record
                  pauland Level 4

                  jomor21 wrote:


                  And how I can stop the service?




                  Your PHP service should not return duplicate records, you need to fix that service rather than try and clean up the datagrid.


                  I'm afraid your description of the problem is not clear.


                  Either you are getting duplicates from the PHP service or you are adding duplicates in the program itself.

                  • 6. Re: DataGrid duplicate record
                    jomor21 Level 1

                    OH Sorry,

                    The problem is only with the DataGrid, when I add a record crush the last selected record with the new data and adds the new record, being doubled, but if I leave and enter the application again everything is fine.


                    • 7. Re: DataGrid duplicate record
                      DonMitchinson Level 2

                      You need to show the code where you 'add a record'.

                      Are you adding one new record at a time?

                      I think everyone is assuming you're filling your dataprovider array in one shot - is that true?


                      You'd save yourself a lot of time and get a quicker solution if you'd post your code that loads the array

                      or adds to the array.


                      If your PHP service is correct then you probably just need to clear the old array (removeAll) and add the new result.data.

                      • 8. Re: DataGrid duplicate record
                        jomor21 Level 1

                        I've solved the problem, was my mistake.


                        I put in my code:


                        articulos.idarticulo = idarticuloTextInput.text;



                        createArticulosResult.token = articulosService.createArticulos (items);


                        and must be:


                        var articulos2: Items = new Articles ();

                        articulos2.idarticulo = idarticuloTextInput.text;



                        createArticulosResult.token = articulosService.createArticulos (articulos2);



                        The program changed the last record data selected from the new record and then added the new record.



                        Thank you very much everyone for your help.