Editor submit on blur
Editor submit on blur
I have a datatable initialized with legacy ajax = true. I'm sending json data with the request:
editor = new $.fn.dataTable.Editor( {
ajax: {
"url": url,
"contentType": "application/json",
"type": "POST",
"data": function ( d ) {
return JSON.stringify( d );
}
},
legacyAjax: true,
table: "#table",
idSrc: "id",
fields: [ { name: "weekNumber" },
// Activate an inline edit on click of a table cell
$('#table').on( 'click', 'tbody td', function (e) {
editor.inline( this, {
submitOnBlur: true
});
});
The actual data sent to the server is:
{
"action":"edit",
"data":{"weekNumber":"1"},
"id":"857578"
}
The server is returning:
{
"data":[
{
"DT_RowId":"row_857578",
"weekNumber":"2"
}
]
}
The problem is the data table UI is not updating back to it's original state. i.e. normally week number is displayed as text but when I click on it it's transformed into an input box. And when I jump off the row, the value from the table is removed.
Any suggestions? Am I missing something?
This discussion has been closed.
Replies
What is happening here is that the server is only returning the value that was changed, but Editor requires that the data for the full row be returned. That is so information from the server, e.g. An updated time stamp, can be shown correctly.
This is a requirement that will be relaxed in 1.6, but it is present at the moment I'm afraid.
Regards,
Allan
ok, good to know. Thanks.
I'm still having trouble. Here are my fields:
My client to server request:
That looks okay to me. Can you link to the page showing the issue so I can debug it please.
Allan
Can I send you a link via email?
I just saw the "message" button. I'll send you a message.