wrong format of new record from server
wrong format of new record from server
Hello,
maybe someone can help me to see what is wrong.
I have many tables were I sinert with the new button of datatables new records and it is normally really working well. But in my example I can't see what is wrong.
My table is:
messagetypeTable = $('#messagetypeTable').DataTable( {
dom: "Blfrtip",
ajax: {
url: url,
dataSrc: ""
},
rowId: "id",
columns: [
{ title: "Id",
data: "id"
},
{ title: "Name",
data: "name"
},
{ title: "Format",
data: "format"
},
{ title: "Language",
data: "language"
}
],
buttons: [
{ extend: "create",
editor: messagetypeEditor,
formTitle: "Fill/choose one name field and one format field for message type"
},
],
select: 'single',
ordering: true,
order: [[ 1 , 'asc' ],[ 2 , 'asc' ]],
processing: true,
deferRender: true,
paging: true,
pageLength: 100,
lengthMenu: [ 50, 100, 200 ],
scrollX: "100%",
scrollY: 500
} );
The application got back from server a data record:
[{"id":1228,"language":"english","format":"TECCOM","name":"in advanced shipping note"}]
after insert, but the editor popup is not closed and the new record not shown in the table. I know this can happen, if the response structure don't match the table structure, but I can't see at the moment the difference.
I made a debug awoyuj
Have somebody an idea what is wrong with the response?
Thanks for a hint.
This question has an accepted answers - jump to answer
Answers
Editor expects data back in the format described here. Specifically, the new data must be in the data parameter of the returned object.
Allan
This hint was exactly what I needed, it opened my eyes again, to see that I forgot in this case:
Now it is workiing as all the others. I searched so many days for that problem.
Thank you very much!!