how do I turn $('#example').dataTable() into a function?
how do I turn $('#example').dataTable() into a function?
Hi, I would like to call $('#example').dataTable() from an event (e.g. button click) rather then automatically on document ready (as in the examples). Possible I might call it several times each time with a different argument and have to destroy previously created datable. Is there any example for this?
Thanks and kind regards,
Patrick
Thanks and kind regards,
Patrick
This discussion has been closed.
Replies
ruzz
$('#whatever').click( function () {
$('#example').dataTable( { "bDestroy": true, ... } );
} );
[/code]
will do it nicely.
Allan
This is what I wanted to ask ... and googled the following solution:
[code]
$(document).ready(function() {
$('select').change(function(){
drawTable(val);
});
function drawTable(arg1) {
$('#example').dataTable( { "bDestroy": true, ... } ); }
});
[/code]
Works nice. I really start to like dataTables.
Ruzz, Allan, thanks.
-Patrick