When I set info to false: Uncaught TypeError: Cannot read property 'length' of undefined.. happens
When I set info to false: Uncaught TypeError: Cannot read property 'length' of undefined.. happens
Hi,
I noticed that when I set the info property (that display info in the footer) on a DataTable to false, I am getting an error in the Editor functionality: Uncaught TypeError: Cannot read property 'length' of undefined..
So for the time being I keep this property set to true..
Does anyone know why this happens? I want to set it to false because I have a scenario with very little data and I want the page to be as clean as possible (without displaying unnecessary info).
Thanks,
Bert-Jan
Answers
Can you give me a link to the page please? I've just tried it locally and haven't been able to reproduce the error I'm afraid.
Thanks,
Allan
Same thing here
Thanks.
If you mean "same problem", then obviously Allan's answer applies to you too.
No specific code here + Extranet.
In a nutshell:
$('#example').DataTable( {
paging: false
} );
=> no issue
$('#example').DataTable( {
info: false
} );
=> "Uncaught TypeError: Cannot read property 'length' of undefined"
Thanx.
This example works:
http://live.datatables.net/nehociko/1/edit
The init code:
What is needed is a link to your non-working page or to a test case showing the issue. Otherwise there is not enough info to troubleshoot. Possibly providing debugger info may help.
Typically that error means the number of table columns doesn't match the number of data elements return for each row.
Kevin
Thank you for your quick reply.
I understand this means the number of table columns doesn't match the number of data elements. As I can't link to the private page, I'll get back to you with a JS Fiddle soon.
If I find the origin of the issue in the meantime (first time I come across and been using DT for years), I'll post it here of course.
Thank you for your time.
Can't reproduce the bug in a JS Fiddle. Bug is still present in all tables in our app though:
info:true is OK (displaying relevant data e.g Showing 1 to 10 of 57 entries)
info:false returns the infamous "Uncaught TypeError: Cannot read property 'length' of undefined"
So can't tell, really. But found a workaround by setting the info label to void:
info:true,
language: {
"info": '',
}
Thanx again for your previous answers.
Its probably related to the data that is being fed into the table. But really without being able to see a test case there isn't much we can do to be able to help fix it.
Good you have a workaround though.
Allan