Mysterious duplicate rows appearing that don't exist in the database?

Mysterious duplicate rows appearing that don't exist in the database?

SnacklesSnackles Posts: 33Questions: 8Answers: 0

Hi all,

So, I'm suddenly experiencing an issue with these duplicate records appearing out of nowhere and I was curious if anyone has ever encountered something like it. I've reverted all the changes I've made to code that I know did not have this issue, so I'm pretty stumped.

I have a button that calls create() and allows me to fill out a form and submit it. This all goes well and submits the form perfectly fine. However, when I refresh the page, suddenly the row shows up twice in the table. What's even weirder is when I check the SQL table that holds this data, there is only one record there.

If I edit or delete one of the duplicate rows, after refreshing the page, the other will be updated or deleted.

The JSON response does show a duplicate row returned, row_33763, but I have no idea how it's getting there.

Anyone have any ideas?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,953
    Answer ✓

    The JSON response does show a duplicate row returned, row_33763,

    Is this the response from the create()?

    Are you using the Datatables provided Editor server scripts?

    However, when I refresh the page

    How are you doing this? Via API to reload the table, manually reloading the web page, etc.

    I would look at each step in detail when creating a record. Debug the server script to see what it does when inserting the record and verify the response matches the Create Data Exchange protocol.

    If that looks correct then I would look at the query and response when "reloading the page" . Is the query different than the one you use to manually check for the record?

    Can you post a link to your page so we can take a look or a test case replicating the issue so we can help debug?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • SnacklesSnackles Posts: 33Questions: 8Answers: 0

    I figured out the issue and it was an embarrassingly easy fix. It was the initial request for data that loads the table to be displayed.

    I opened the SQL Server Profiler, watched the initial request to load the table come in, copied the query and started tinkering with it and realized one of the many joined tables it was calling had duplicate values in it...

    Lesson learned -- if you're going to work while you're sick, don't panic post when something goes wrong, just wait til you feel better.

This discussion has been closed.