Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82402

How to add animated effect for auto datatable switching.

$
0
0

Hi all,

I have created a data table with the function of auto switching the table pages. but I can't figure out how to add animated effect to the table every time it switches the page. I attached my code below. $('#apinfo').addClass('animated fadeInDown') is where the animation kicks in, but it can only happen once since table.page(pageNum).draw(false) doesn't reload the page. It seems like I need to use draw(false) to keep the content the same so it can auto switch the pagination. Do you guys any any suggestion? Thank very mush for your help.

$(document).ready(function() {

$('#apinfo').DataTable({
        "searching": false
      });

var table = $('#apinfo').DataTable();
$('.dataTables_length').addClass('bs-select');

$('#apinfo').addClass('animated fadeInDown');

setInterval(function() {
    var info = table.page.info();
    var pageNum = (info.page < info.pages) ? info.page + 1 : 1;
    table.page(pageNum).draw(false);
}, 3000);

});


Viewing all articles
Browse latest Browse all 82402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>