Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide jQuery datatables

How do I to hide jQuery datatables, when I want to toggle the datatable's visibility? The problem is if I write hide statement it only hides the rows, not the headers and footer. How can I hide datatable fully?

For hiding, I used the below code:

 var oTable = $('#example').dataTable(); // 'example is the table id'
 oTable.hide();
like image 546
Rajaram Shelar Avatar asked Apr 05 '13 07:04

Rajaram Shelar


People also ask

How to hide JQuery dataTable?

For hiding, I used the below code: var oTable = $('#example'). dataTable(); // 'example is the table id' oTable. hide();

How to hide and show column in dataTable JQuery?

To hide and show columns use columns() and visible() method. Call it on dataTables instance and pass column index in columns() method and false to visible() method. Similarly, pass true to visible() if you want to show the columns.

How to hide column visibility in dataTable?

DataTables and show and hide columns dynamically through use of this option and the column(). visible() / columns(). visible() methods. This option can be used to get the initial visibility state of the column, with the API methods used to alter that state at a later time.


1 Answers

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

 <div id='divTable'>
     <table>
     </table>
 </div>

 $('#divTable').hide();
like image 186
badr slaoui Avatar answered Sep 30 '22 06:09

badr slaoui