Editor v1.5.0 make duplicated rows when create new row

Editor v1.5.0 make duplicated rows when create new row

nylltznylltz Posts: 5Questions: 2Answers: 1
edited August 2015 in Editor

Hi All

Here I have an odd question when I modify my code as the Editor plugin upgrading from v1.4.2 to v1.5.0.

All the existing rows get duplicated when I try to add a new row whenever I use the native CREATE button or my customized button that called editor.create() API. Moreover, the EDIT button doesn't make the updated value change after the editor form closes. I haven't had any above problem when I use v1.4.2.

1.When I try to create a new row
Alt text

2.On the background you can see all the existing rows get duplicated when I click the CREATE button. This happens when the aJax call return succeeds.
Alt text

3.As shown all the existing rows get duplicated
Alt text

  1. The duplicated rows disappears because I refreshed page and it reload the default listing aJax.
    Alt text

I think the major changes I made are the data format I send back to server side and the new imported "dataTables.select.min.js" and "dataTables.buttons.min.js" which replaced old "dataTables.tableTools.js".

To be assistant I paste my problem code here. It uses v1.5.0: http://live.datatables.net/zawudice/1/edit?html,js,output

I also paste my old code which uses v1.4.2. It works well and doesn't have any problem: http://live.datatables.net/yerutepi/1/edit?html,js,output

I appreciate any suggestions from you guys.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi,

    What are you using on the server-side? If the PHP or .NET libraries that are bundled as part of the package, have you upgraded them as well? If not them, then have you updated your server-side scripts to take account of the change in data interchange format? You can use the legacyAjax option to have it send the old format if needed.

    Allan

  • nylltznylltz Posts: 5Questions: 2Answers: 1
    edited August 2015

    Hi Allan

    I use a customized Java Stuct2 Action to return a JSON from server-side. I think the v1.5.0 new data format causes the problem but I can't find where it is wrong.

    Probably I can paste the JSON string from server-side to make some help.

    This is aJax responsed JSON string when the page is open. It works fine and all the rows could be listed. Nothing different with Editor-1.4-2.

    {data=[{closeLevel=0.0, lowestLevel=0.0, highestLevel=0.0, DT_RowId=0, epic=CS.D.AUDUSD.MINI.IP, profitLowestLevel=0.0, modDatetime=Thu Aug 06 12:27:45 AEST 2015, type=0, noOpenDeal=0, marketID=5, profitHighestLevel=0.0, createDatetime=Thu Aug 06 12:27:45 AEST 2015, expire=null, noClosedDeal=0, strategyID=0, id=0, maxOpenDeal=0, balanceLevel=0.0, profit=0.0, status=0}, {closeLevel=0.0, lowestLevel=0.0, highestLevel=0.0, DT_RowId=7, epic=CS.D.AUDUSD.MINI.IP, profitLowestLevel=0.0, modDatetime=Tue Aug 25 13:10:43 AEST 2015, type=0, noOpenDeal=0, marketID=5, profitHighestLevel=0.0, createDatetime=Thu Aug 06 12:27:45 AEST 2015, expire=null, noClosedDeal=0, strategyID=0, id=7, maxOpenDeal=0, balanceLevel=0.0, profit=0.0, status=0}]}

    This is a generated JSON string when I tried to update a value. However the client didn't update the value until I manually refresh page. (In fact the related data has been updated in database. The frontend can't keep sync). This is using Editor-1.5.0

    {data=[{closeLevel=0.0, lowestLevel=0.0, highestLevel=0.0, DT_RowId=7, epic=CS.D.AUDUSD.MINI.IP, profitLowestLevel=0.0, modDatetime=Tue Aug 25 13:22:14 AEST 2015, type=0, noOpenDeal=0, marketID=5, profitHighestLevel=0.0, createDatetime=Thu Aug 06 12:27:45 AEST 2015, expire=null, noClosedDeal=0, strategyID=1, id=7, maxOpenDeal=0, balanceLevel=0.0, profit=0.0, status=0}]}

  • nylltznylltz Posts: 5Questions: 2Answers: 1
    edited August 2015 Answer ✓

    Allan I think I found the reason. When I test my Editor-1.4.2 page I found it actually gave 2 aJax calls when I click CREATE/EDIT button. The calls sequence went as the following sequence.

    XHR finished loading: POST "http://localhost:8888/IGAutoTrade/market!create".

    XHR finished loading: POST "http://localhost:8888/IGAutoTrade/market!execute".

    However, when it come with Editor-1.5.0 it also gave 2 aJax calls but the sequence was:

    XHR finished loading: POST "http://localhost:8888/IGAutoTrade/group!execute".

    XHR finished loading: POST "http://localhost:8888/IGAutoTrade/group!create".

    That's why I always found the existing rows get double and my added/updated rows appear.

    Many thanks!

This discussion has been closed.