How to hide jQuery data

How do I hide jQuery data when I want to switch data visibility? The problem is that if I write a hide statement, it only hides the lines, not the headers and footers. How to completely hide data?

To hide, I used the code below:

var oTable = $('#example').dataTable(); // 'example is the table id' oTable.hide(); 
+7
source share
3 answers

try it

 $('#example').parents('div.dataTables_wrapper').first().hide(); 
+13
source

I think the best way is to include the table inside the div and hide the div

  <div id='divTable'> <table> </table> </div> $('#divTable').hide(); 
+7
source

For me (and I know that it would be a strange need) I needed to hide the main table, but save the results (i.e. the X-results of X are filtered out).

$('div.dataTables_wrapper thead,div.dataTables_wrapper tbody').hide();

The above is fixed for me. If you have a footer, you also need to add ,div.dataTables_wrapper tfoot .

0
source

All Articles