If I use deferLoading, can I hide the "no records found" until the first reload?

If I use deferLoading, can I hide the "no records found" until the first reload?

QternocqQternocq Posts: 5Questions: 3Answers: 0

I'm using deferLoading to keep my datatable from loading data before the user presses "search". This works flawlessly. The problem however, is that the datatable does show the message "no records found" before searching, which is a bit confusing for some of the users. Is there any way around it?

I've tried one thing:
var searched = false;
upon pressing "searched" i set it to true
At first I make sure the "zeroRecords" and "emptyTable" in "language" are empty and I try to fill them dynamically in "fnDrawCallback" when searched === true. This doesnt seem to work. I think it might be because the table is already drawn at that point. It also messes with other datatables on the same page that share the code.

Any guidance would be greatly appreciated, be it a completely different approach or the location in the code I should use to change the message dynamically.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    Answer ✓

    No there isn't as that isn't something that the deferLoading option was designed for. It should be used with a pre-populated table.

    You could perhaps just hide the whole table and show it, and initialise it, only whent he search buttons is pressed.

    Allan

  • QternocqQternocq Posts: 5Questions: 3Answers: 0

    Thank you for your reply. That is indeed a possibility I will consider. Maybe show a placeholder with the same styling (should be easy with bootstrap). Anyway, thank you and thank you for the tool in general. I use it for a lot of projects and keep considering to purchase Editor, I just haven't needed it much yet :-)

This discussion has been closed.