New added row not showing (instead, showing first record twice)
New added row not showing (instead, showing first record twice)
Hi,
I am using Editor version 1.4.2 and DataTables 1.10.7 with ASPNET WebApi2 project and SQL Server 2014. I am using the same sample posted here http://editor.datatables.net/manual/net/webapi. Update and Delete actions work fine, but Create one does not. It creates the record in the table, but the server data always returns the first row of the table, not the new one, as it should be and it is explained here: http://editor.datatables.net/manual/server Therefore it shows the first record of the table twice, plus all other records (except the new one). When I refresh the page, the records are shown correctly.
Any clue about what could be the problem?
Thank you very much in advance.
This question has an accepted answers - jump to answer
Answers
Hi,
Thanks for your question. A couple of questions in return:
Thanks,
Allan
Hi Allan,
Answering your questions:
- SQL Server 2014 Standard Edition.
- Yes, the table has a primary key ID Field that is autoincrementing.
- No, I don't show the ID Field in the table and do not submit it.
Thank you very much for your assistance.
Ferran.
Very odd! Could you possibly show me your controller, model and the Javascript you are using please? I haven't come across this one before I'm afraid, so I don't have an immediate answer for you.
Allan
Model:
Controller:
Javascript:
A part from that, I am loading the Bootstrap integration libraries, as noted in this sample: https://editor.datatables.net/manual/styling/bootstrap
Thanks!!
Hi,
Thanks very much for the code! I'm afraid I don't immediately see anything wrong with it there!
Could you possibly try using Generator to build a package and check if that works with your table. I've just tried it myself with the following configuration:
That will create a package that is almost identical to your code above. The two differences are:
To run the Generator package it should be a case of plugging in the options from my image above, then updating the database connection in the controller and pressing run.
In my own test with that just now it doesn't have any issues with the addition of new rows.
I'm really sorry you are having problems with something that should be completely straight forward here!
Allan
I'll try it again! Very odd as you said before!!
Anyway, thank you very much!!!
If you do get a chance, I'd be interested to hear how you get on with it!
Allan