How can I hide the loading indicator when no items are returned?

How can I hide the loading indicator when no items are returned?

SoN9neSoN9ne Posts: 7Questions: 1Answers: 0
edited March 2014 in DataTables 1.9
Hello,

I finally got the loading indicator working but I have one issue with it. I have a problem with datatables not hiding the loading indicator when there are no items returned. Basically, it shows the single row that says no items but under that is still the loading indicator. is there a toggle to hide that somehow or is this logic I need to add manually?

I have [code]"sScrollY": 600[/code] which gives me a fixed height for the table. So when there is a single row the [code]DTS_Loading[/code] div is still visible.

Any suggestions are helpful.

I wasn't able to give a link as this is only local dev only right now and there are too many required files to get a prototype on jsfiddle. Sorry :(

Is this normal behavior? What should happen to the loading indicator when there is only 1 row and there is a fixed height. I haven't tested this yet but it seems it will always show the indicator if the results don't fill the table.

I did notice it does it here too: http://datatables.net/release-datatables/extras/Scroller/server-side_processing.html
(do a search of zzzz)

So I am guessing I need my own logic to handle this.

Thanks for any info
Jeremy

Replies

  • SoN9neSoN9ne Posts: 7Questions: 1Answers: 0
    Unless someone has a better idea. I did this by calling [code]$('.DTS_Loading').hide();[/code] if the rows are less than 30 and I now always call [code]$('.DTS_Loading').show();[/code] at the first line in [code]fnServerData[/code]
  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    The theory was that you'd never be able to see the loading indicator, so there was no need to show and hide it...

    In the case of my example you would use `bScrollCollapse:true` to fix it.

    Allan
This discussion has been closed.