Empty results text

Empty results text

johnblythejohnblythe Posts: 92Questions: 21Answers: 2

Errr, I'm half embarrassed to even ask, but haven't found anything browsing around as of yet so here goes nothing: I'm trying to give a custom message to users when they've filtered themselves into a dead end. I've got infoEmpty, empty, and zeroRecords all set up with my custom text.

They show up accurately when I use checkbox filtering that is tied to different columns and their unique data (e.g. all the unique vendors within the vendor column). They show up too when I begin using the free form filter. Where it breaks down, however, is when I apply that free form filter.

The key up searching works like the usual out of the box use case with Datatables. When a user begins typing, however, they can then apply their filter with a click or hitting enter. This then 'holds' the value constant until they remove that filter or reset them all. When they apply the text changes to the stock "No results found."

FWIW, the way I do this is by copying the applied term to a hidden input which listens for changes (like the checkboxes do) and then applies the filtering upon change:
dt.search($(searchBox).val(), false, true).draw();

I'm not seeing any reason, though, for that one means of search to show a separate message.

Any thoughts?

Thanks!

Answers

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    language.zeroRecords is the one you want I think. If the table has records in its data set, but they have been filtered out, that it the one that is shown.

    If that isn't working, can you link to the page showing the issue so it can be debugged.

    Allan

This discussion has been closed.