jquery - How to add Show All and hide All in colvis code -


i have code colvis. work fine.

<script> $(document).ready( function () {     var table = $('#record_fpa1').datatable( {           "sdom": 'r<"h"lfr>t<"f"ip>',                     "bjqueryui": true,                     "spaginationtype": "full_numbers"     });     var colvis = new $.fn.datatable.colvis( table );     $( colvis.button() ).insertafter('div.info');  });         </script> 

my problem want add additional button inside above code show , hide colvis data table not working. code below:

$(document).ready(function() {     $('#example').datatable( {         dom: 'c<"clear">lfrtip',         columndefs: [             { visible: false, targets: 2 }         ],         colvis: {             restore: "restore",             showall: "show all",             shownone: "show none"         }     }); }); 

how combine below code first code above?

colvis: {     restore: "restore",     showall: "show all",     shownone: "show none" } 

you must add letter c in dom of datatable, letter refers show colvis:

"sdom": 'cr<"h"lfr>t<"f"ip>', 

result: https://jsfiddle.net/cmedina/7kfmyw6x/47/


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -