When datatables returns results that are empty, the "datatables_empty" class doesn't get added
When datatables returns results that are empty, the "datatables_empty" class doesn't get added
eshans
Posts: 11Questions: 3Answers: 0
Hi all - weird problem. Sometimes the datatables_empty class gets applied when there's no results but other times it doesn't. Is there a way to write code to say if the results are empty, add this class (with the required colspan)? Thank you. The image is below.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Sorry this is the code that renders the table
Can you link to a page showing the issue so I can understand why this is happening and offer some help with solving it please. It isn't an issue I've come across before that I can recall.
Allan
Thanks Allan - it's a site in development so I can't really post it publicly unfortunately. Sorry
Also, is there a way to just check to see if the data coming back is empty and if so, just apply the empty class?
DataTables should do so. Can you show me the data that is being returned?
Allan
Here's the firebug screenshot
theData
isdata.results
from the JSON? That should work okay.Allan
It is, yes. Thanks, I don't know what's going on here. haha
Hey allan, here's a screenshot of the markup. Could it be anything to do with knockout.js?
Very possibly - without being able to debug the page it is very difficult to say. Due to the lack of colspan and class information, it would appear that the row being written in the tbody is not being created by DataTables. Perhaps it is being created by something else, which is where the problem would be.
Allan
ok thanks. it's definitely DT creating it just (the above code) but maybe something else is interfering with it