Basic set-up of datatables extensions
Basic set-up of datatables extensions
I'm really new at this, so I don't know exactly how best to phrase my question... I also could not get the extension colVis set up in the DataTables live environment either...
I've got the basic datatables config set up with my ruby on rails application with the javascript:
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.2/css/jquery.dataTables.css"
script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery 1.10.2.min.js"></script>
script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.js"></script>
$(document).ready( function () {
$('#cards_lists').DataTable(
);
} );
embedded in my index.html.erb file (where I have my html table set up with the thead and tbody tags and proper table id)
I want to use some of the datatables extensions, specifically the colVis extension, I've tried doing the initialization of the extension using:
$(document).ready(function() {
var table = $('#example').DataTable();
var colvis = new $.fn.dataTable.ColVis( table );
$( colvis.button() ).insertAfter('div.info');
} );
and also trying,
$(document).ready(function() {
$('#example').DataTable( {
dom: 'C<"clear">lfrtip'
} );
} );
But, to no avail... I included the CDN links for both the css and the js of colVis.
Could anyone run me through how to use extensions?
Answers
Both of the above options you have tried should work, so I think we'd need a link to a page showing the problem. Here is an example using your second method: http://live.datatables.net/jocidini/1/edit
Allan