idSrc not being written back in table row
idSrc not being written back in table row
Hey guys!
I have a problem since a couple days. I set up editor with a REST interface where I coded the different actions like create, delete, edit. Everything works fine except one thing. When I edited a row for the FIRST time, it saves everything in the database. But when I edit the same row again without loading new data, the row gets only updated in the html table but not in the database. After further investigations I found out that editor doesn't write the idSrc back into the table row even thoug I return it like described in the server data page (https://editor.datatables.net/manual/server)!
Further I realised that when I click on the edit button the id is sent as a seperate variable but on the server data page it is like this data[id][columns].
What did I do wrong or how can I fix this problem?
I appreciate your help!
Answers
Hi,
Are you able to give a link to your page so I can take a look and see what is going wrong? I think the key thing will be to check that the data that the server responds with from the edit request is what Editor expects and that the
data
property contains an array of the row(s) that have exactly the same structure as the table when it was first loaded.Allan
Hi Allan,
Unfortunately I can't give you a link to my page because my page is only accessible in my company. Does the return data have to be exactly like on the page? Because at the moment I only got the part in the data property. What I mean is that I return only the array with the data but without the data property.
Basically yes. Obviously it will be slightly different for the values and the fields specified, but the basic structure must be defined in the same way.
Are you able to modify the server-side to return the whole row? We could perhaps define an event handler that will extend the data that the DataTable holds with the limited set from the server (in
postSubmit
), but if you are able to change how the server-side operates, that might be preferable.Allan