Bug with server side processing + deferLoading and columns definition?!
Bug with server side processing + deferLoading and columns definition?!
tinogo89
Posts: 3Questions: 0Answers: 0
Hello,
I've just discovered a possible bug when using server side processing, deferLoading and using column definitions.
As an Example, just adjust the "Deferred loading of data" as follows:
[code]
$(document).ready(function () {
$('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": "scripts/objects.php",
"columns": [
{ "data": "first_name" },
{ "data": "last_name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "start_date" },
{ "data": "salary" }
],
"deferLoading": 57
});
});
[/code]
As a result, you will get the following error message:
[quote]
"DataTables warning: table id=example - Requested unknown parameter 'first_name' for row 0. For more information about this error, please see http://datatables.net/tn/4"
[/quote]
Am I missing something or is it a bug?
I've just discovered a possible bug when using server side processing, deferLoading and using column definitions.
As an Example, just adjust the "Deferred loading of data" as follows:
[code]
$(document).ready(function () {
$('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": "scripts/objects.php",
"columns": [
{ "data": "first_name" },
{ "data": "last_name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "start_date" },
{ "data": "salary" }
],
"deferLoading": 57
});
});
[/code]
As a result, you will get the following error message:
[quote]
"DataTables warning: table id=example - Requested unknown parameter 'first_name' for row 0. For more information about this error, please see http://datatables.net/tn/4"
[/quote]
Am I missing something or is it a bug?
This discussion has been closed.
Replies
Allan
thank you for your quick reply.
Yes, the "preloaded" data is present inside the table body.
Do these table rows/cell need some additional information/attributes, so that DataTables registers them as preloaded data?
Regards
Btw: The Server Processing examples on next.datatables.net are currently not working, e.g. http://next.datatables.net/examples/server_side/simple.html .
No they should just work. I've got a feeling that the issue is the use of objects in the data source, rather than arrays, which is how DataTables reads the DOM data. I'm not entirely sure how to address that at the moment...
> The Server Processing examples on next.datatables.net are currently not working
Darn - thanks for letting me know about that!
Allan
okay - so there is currently no other solution, than disabling deferLoading when using column definitions?
If yes - what do think how long it would take to fix it?
Regards and keep up the good work!
The problem is that the DOM source is arrays, and your data is objects - they are completely disparate. Possibly it would need a bypass on reading the DOM data, but that would break things such as column visibility and so on.
Allan
Hi Guys,
Any update on this issue. Is there a way I can tell datatable to ignore the column.data info until the first server call is made?
In the mean time, I found that we can use the
data
option withdeferLoading
to load the initial data without using the DOM.I am experiencing the same issue when trying to upgrade from 1.9.4 to 1.10. The deferLoading functionality was working in 1.9.4, but now returns the same error described above ( ...Requested unknown parameter... ).
My current work around is to deactivate the deferLoading feature.
Rich
@Coggsfl - and you link to a test case showing the issue please?
Allan
@allan - here you go : http://debug.datatables.net/agelom
Thanks
Rich
Thanks. This is confirmation of my suspicions about the issue being related to using object data from the server, but array data from the first read from the DOM.
I'm afraid I don't have a fix for this yet, but I will try to work on one soon.
Allan
Hey Allan,
Just checking in on the fix. I'm sure you're super busy, but it would be nice to get this one sorted. I'll be happy to give it a try if you have a suggestion on where to start.
Thanks
Not yet, I've been working on other things. I think the fix for this will be to map the data from the DOM to an object, rather than an array (which is also the subject of another bug, which I thought I had filed on github, but apparently not...).
The starting point would probably be in this function.
Allan
Thanks for the update! We actually just switched today from server side back to client side processing. Should we go back, I'll attempt to fix the bug, and submit a pull request.
You can always parse the DOM data for DataTables like so: