Table always displays showing 0 to 0 of 0 entries filtered
Table always displays showing 0 to 0 of 0 entries filtered
simotux
Posts: 19Questions: 4Answers: 1
https://debug.datatables.net/araqek
Hello guys,
I'm using datatables 1.10 and the footer always displays as title. I've already found and read other similar topics but i can't resolve this issue.
I get data from array through JQuery script. It seems that table can't recognize rows.
Thank you in advance!
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I don't immediately see the issue from the debugger. Could you give me a link to the page please?
Allan
Hello allan,
please check your private messages with the account info.
Thank you,
Simone
Hi Simone,
Thanks for the link - but I'm a bit confused I'm afraid. Your table doesn't have a footer (
tfoot
) so I'm not sure what the issue is?You also appear to be adding the table elements directly to the HTML rather than using the DataTables API, or having it load them via Ajax. See this FAQ for why that won't work.
Allan
Excuse me, I got confused: i wanted to say in thead. I load data in tbody, calling an 'id' that contains the result of JS html append with query result.
Thank you,
Simone
Ok, i've solved the error but i get a new one:
"TypeError: Cannot read property 'length' of undefined"
This appear only on Chrome and Safari, not in Firefox.
Thank you in advance,
Simone
Can you show me (or tell me where to find) the code where you add the rows to the table please? I don't seem to be able to find it.
Allan
Sure :) thank you!
P.S. "undefined" text is just for a test.
Thanks. It would appear you are adding the content to the table directly, rather than using the DataTables API. As I noted above:
You can see that causing issues when you try to order the table - click to sort and all the data disappears (since it hasn't been added to the DataTable).
Either let DataTables make the Ajax request or use the
row.add()
method to add a row to the table.Allan
Hello Allan,
thank you for your reply.
I didn't change anything, but i noticed that sometimes only Firefox is able to show correctly rows and searchform (sometimes, not always). What could be the problem in this case?
I guess is not the API, at this time, but i'am not sure.
Thank you,
Simone
I don't think so. As I say above, you need to add the rows to the DataTable and let it update the DOM. If you update the DOM yourself, then DataTables doesn't know that!
Allan
Hello Allan,
Forgive me. I'm a newbie and i did a misunderstanding but you replied and helped me like a super hero :) now i've got and i see that i receive a right array (via console.log).
I can't see rows cause this problem: "Uncaught TypeError: Cannot read property 'aDataSort' of undefined". I searched over the documentation but i can't understand what i have to put. Thank you for your precious help!
Could you update the link you sent me with your changes so I can take a look and see what is causing this error?
Thanks,
Allan
Here we go :)
https://testredazione.flickonfood.com/ingredienti2.php
Thank you!
Simone
Ok. Now no error but table results empty. Thank you :(
I get a Javascript error in the console:
the line is
var dateArray = reggie.exec(el.data_update);
(:184)reggie
doesn't appear to be defined anywhere.Allan
...and not only. I also used row.add like suggested by you:
It works like a charm! I did various errors and i didn't understand your point completely (cause i'm newbie, not you).
You're a wizard! Thank you for your big help and your amazing plugin!