Datables is not updated after onblur event occurs
Datables is not updated after onblur event occurs
https://debug.datatables.net/alenic
Description of problem:
After having updated a cell onblur event occurs and the server side method is called and completed; I have verified that json response is correct but the datatable is reset with all 0 values.
Until few days ago the datatable was updated regularly with data returned from server side. This strange behaviour has been reported some days ago (the edited cell is reset to 0 value )
I 've also updated DataTables from 1.10.21 to 1.13.4 and Editor from 2.0.5 to 2.1.2, but this has not resolved my issue.
This is how onBlur event is called in my code:
editor.inline(table.cell(this).index(), {
onBlur: 'submit'
});
Thanks for your help
Replies
This example, using the same code as you, is working.
Are you using the browser's network inspector to see the XHR response?
Sounds like something specific with your page since the linked example works. Can you provide a link to your page or a test case replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Hi, thanks for your reply.
You can verify the real behavior browsing this link:
https://ordini.optoteam.it/
At the top of the initial page you have an horizontal menu; select "PREMONTATI"
then a login is required.
Use the following credentials to authenticate
Email: test@optoteam.it
Password: Optoteam2023%
After successful login you should land to a page for PREMONTATI; just select the checkbox "I Need you" on the left side filter and some pictures of eyeglasses should appear.
Click on a picture and then you should see a datatable grid.
This grid shows green cells that can be edited with numeric values; try to enter a numeric value in a green cell, then clicking out the edited cell should let the cell be updated with the new value just entered, but the cell results to be reset to 0 value.
What we expect is that the edited cell is updated with the new value.
If you need more informations please let me know.
I hope you have all is needed to debug.
Thanks for your help.
Enrico.
Thanks for the link! When I click to blur after changing a value I can see the POST request made to
https://ordini.optoteam.it/api/apipremontati
. That includes the edited value - e.g.:The response from the server contains:
So Immediately there is a discrepancy between the field name submitted and the data returned - i.e.
What code are you using at the server-side for this?
I think your
label
andname
values might be the wrong way around in the Editor configuration. i.e. change:to be:
Allan
Hi Allan thanks again for your help.
I will try to change
{ label: "qta100", name: "Qta100" },
in
{ name: "qta100", label: "Qta100" },
What I cannot understand is that this code has not been modified for several months and was running correctly.
Anyway, serverside I have Asp.Net Core and the response is converted in json format.
I will let you know if this resolves the issue.
Enrico.
Changing the editor configuration in this way has not resolved the issue: the cell is still reset to 0.
fields: [
{ label: "idModello", name: "IdModello" },
{ label: "fotoColoreProdotto", name: "FotoColoreProdottoUrl" },
{ label: "codModello", name: "CodModello" },
{ label: "desColore", name: "DesColore" },
{ label: "qta000", name: "Qta000" },
** { label: "Qta100", name: "qta100" },** <=====================
{ label: "qta150", name: "Qta150" },
{ label: "qta200", name: "Qta200" },
{ label: "qta250", name: "Qta250" },
{ label: "qta300", name: "Qta300" },
{ label: "qta350", name: "Qta350" },
....
"columns": [
{ "data": "idModello", "name": "IdModello", "autoWidth": true },
{
"data": "fotoColoreProdottoUrl",
"name": "FotoColoreProdottoUrl",
"render": function (data, type, row) {
return '<img src="' + data + '" />';
}
},
Okay, if it was working before, then I was probably guessing wrong. Are you using our .NET libraries at the server-side?
Allan
No, I'm not using DataTable .NET libraries server-side. All Datatable code is used from javascript at the moment.
Hi, the user test@optoteam.it has been renabled.
Do you need more time to investigate and fix the issue ?
Any other suggestions I can check to fix the issue related to onBlur event ?
Enrico.
Apologies for the delay in getting back to you. I just tried to take another look, but I'm getting a
HTTP Error 500.30 - ANCM In-Process Start Failure
error at the moment. I'll check back again later.Allan
Thank you, Allan, I've found a workaround serverside to resolve and now the editor datatable is updated correctly.
Enrico.