Inline editing corrupts table
Inline editing corrupts table
I have a simple Editor application modeled closely after the Datatables example of using local storage as the data source.
I can create, edit and delete using the Editor buttons, but inline and bubble editing don't work - they generate a "requested unknown parameter" error.
Prior to editing a cell, the row data contained in local storage seems correct, but after editing a cell and hitting Enter, the key and value backing other column seem to disappear -- resulting in a missing parameter.
Debugger output is at:
http://debug.datatables.net/ofibur
Code is at:
http://live.datatables.net/gacekugi/1/edit
Sorry, I'm behind a firewall, so I can't provide a link.
I would be very grateful if someone could spot what I'm doing wrong.
Thanks,
Mike
This question has an accepted answers - jump to answer
Answers
Hi Mike,
Is the debug trace from immediately after the error has occurred? If not, could you provide a trace from that point? It looks like it will be from before the error occurs as the data looks okay.
The other thing to do would be to
console.log( d, JSON.stringify( info ) )
in theajax
function so we can see what is being sent and returned.Allan
OK, I have created a running example:
http://live.datatables.net/qarareka/3/edit
To reproduce the error, create a new record and then try to edit it inline.
I think I see the problem. When I edit inline, the custom ajax code (intended for button edit) gets executed -- but the semantics for inline edit is different. How can I get both edit modes to work when the data source is from local storage?
Hi,
Super - thanks for the example, I've got it and understand now :-). This comes about from Editor 1.5's new way of handling inline data. It only submits the field that has been edited, so now doing:
on inline edit would result in only the item that has been edited being stored.
The fix is to extend the existing object with the new value instead of the straight assignment:
Updated example.
I'll add that into the demo code, as I'm sure you won't be the only one caught out by this!
Regards,
Allan
That worked -- thanks, Allan!