New records not showing up using editor extension
New records not showing up using editor extension
Hello,
we are evaluating the editor extension, but we have a problem with the creation of new records.
The new record is correctly saved into the database but it does not show up in the table, we need to reload the page to see it.
We are using only the javascript part of the plugin, here the json response from server to client:
{"data":[{"Id":"62f12a22-001a-4496-8d18-ff2985544a47","Address":"987","PhoneNumber":"987","Notes":"987","Shift":0}]}
Here's the debugger result:
https://debug.datatables.net/onaril
On side note, we have tried the editor server plugin too, (.NET) and the result is exactly the same, the record is created on db but it do not show up in the table.
Thank you in advance.
This question has an accepted answers - jump to answer
Answers
Are you seeing any error message(s)?
No, forgot to specify, we don't have any error message.
If we force the reload like this
we see the new record, but I don't think this should be the normal behaviour.
Am I wrong?
Does the response JSON to the editor ajax call match your Editor setting in regards to dataSrc / root object?
I wasn't, but I fixed it now. Sadly the result is the same, the new record is not showing.
Here's the setup code of the table
This is an example of the json source of the datatable (and it works)
This is the json response to the editor create (the record is created on database, but doesn't show up in the datatable)
And the datatable debugger result updated:
https://debug.datatables.net/ilefed
and no error in console.
Ah ha, got it. You're missing the table config option on the Editor options. Editor doesn't know what table to work on. See
table
Working example: http://live.datatables.net/cinazabo/3/edit
Note, I replaced your ajax urls with DT/Editor function versions so i could simulate an ajax call. The important thing is the table (line 4) option on the editor configuration that shows a row will be created. Adding the table option to your code is all you need to do.
That was it, thank you very much for your help and for the very detailed example!