Event for no records
Event for no records
Hello,
I would like to know whether there is an event that is triggered when there are no records (retrieved by AJAX, for e.g.). I am willing to not render the datatable so I can show a custom message of my own instead.
Thanks.
This discussion has been closed.
Replies
Bump.
There is no event for that as such - you would need to use
drawand then usepage.info()to check how many records there are.Allan
@allan Ok, thanks for your answer! Would it be possible to prevent the table from drawing in
drawso it is not showed? (So I can draw a bootstrap alert instead).Would a
return falsedo the trick?No - the
drawevent happens at the end of the draw to inform you that the table has been drawn. I guess you could hide the table at that point and show a Bootstrap alert if that is what you need tho.Allan
Awesome, didn't think about that. I think this could be a new feature implemented in future versions.
The problem with that is that there should then be an event for just 1 record, 2 records, etc. Having the
drawevent with a single call to the API to get the required information is a nice simple generic way of doing it.Allan