DataTable.draw() not displaying "No matching records found" when search done and empty
DataTable.draw() not displaying "No matching records found" when search done and empty
johnfoll
Posts: 8Questions: 1Answers: 0
Description of problem: Use can query data by drop downs, and in some places typing in Search Criteria. Then the JavaScript eventually calls DataTable.draw(). It only displays nothing if nothing found. In the examples on this site, many of them that allow for queries will display "No matching records found" if nothing found. I need for it to work like that. I have tried stuff like this to no avail:
language: {
searchPanes: {
i18n: {
emptyMessage: "</i></b>No results returned</b></i>"
}
//emptyMessage: "</i></b>No results returned</b></i>"
},
infoEmpty: "No results returned",
zeroRecords: "No results returned",
emptyTable: "No results returned",
},
This question has accepted answers - jump to:
Answers
Use
language.zeroRecords
to customize the message displayed when no records are found when searching. For example:http://live.datatables.net/zipabapu/1/edit
If this isn't working for you then we will need to see an example showing the issue to help debug. Please post a link to your page or test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Btw - your HTML is invalid there. It should be:
You could also use CSS to get that effect.
Allan
I was already trying that before I posted. By doing the custom search and Draw() it may have prevented that functionality from working. I could not aces your first web link.
So my html was invalid. But even invalid html usually displays. Nothing was displayed.
Fixing html does not fix the problem as I suspected. Invalid Html still usually displays. I fixed to <i><b>No results returned</b></i> still does not work.
Your code snippet seems works here:
http://live.datatables.net/ferubaku/1/edit
You browser might be using SSL and changing the HTTP to HTTPS. Try a differnent browser that allows using HTTP.
Please update the test case or provide a link to your page or a test case replicating the issue.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Kevin that example is not using Draw(). The code I am working on does some custom stuff then a .Draw to do the custom search. I need an example that does a custom search and a .Draw()
Ok, I added a custom search and it still seems to be working:
http://live.datatables.net/ferubaku/2/edit
Please update the test case or provide specific steps to recreate the issue.
Kevin
Thanks Kevin. I will need to see how to get our code working and different method.
Ahh I see that "No results returned" was there, but it was hidden from the user. I used the Google Chrome debugger at run time to see this. dataTables_empty class might be the culprit.
.user-support .dataTables_empty {
visibility: hidden;
}
Thanks Kevin. You showed me that it could work. I was able to find the problem - someone had deliberately hide it in one of our .css files.