how create pagination automatic with animation fadeindows

how create pagination automatic with animation fadeindows

AntonioMote96AntonioMote96 Posts: 1Questions: 1Answers: 0

Hello, I have a problem with my table, I wanted to do automatic auto-pagination with an effect, but I have not succeeded, my data is already displayed well, but I have not achieved automatic pagination or animation.

My code

<?php include_once "conexionsql.php"; $con=conectarse(); <?php > <!doctype html> ?> Hello, world!

Hello, world!

<?php $sql = "EXEC rutas"; $stmt = sqlsrv_query( $con, $sql ); if( $stmt === false) { die( print_r( sqlsrv_errors(), true) ); } //$i=0; while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) { ?> <tr align="center"> <td><?php echo $row['TRACTO']?></td> <td><?php echo $row['CLIENTE']?></td> <td><?php echo $row['BITACORA']?></td> <td><?php echo $row['ORDENSERVICIO']?></td> <td><?php echo $row['CARGA']->format('Y-m-d H:i:s');?></td> <td><?php echo $row['DIAS']?></td> <td><?php echo $row['HORAS']?></td> <td><?php echo $row['DESTINO']?></td> <td><?php echo $row['ESTATUS']?></td> </tr> <?php } ?> </tbody> </table> </section> </div>
Tracto Cliente BITACORA Orden Carga Dias Horas Destino Status
TRACTO Cliente BITACORA Orden Carga Dias Horas Destino Status
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
<script >
    $(document).ready(function() {

function initTable(start) {
table = $('#example').DataTable({
"searching": false,
"destroy": true,
"displayStart": 4,
"pageLength": 12,

  initComplete: function() {
    var api = this.api();
    var rowCount = api.rows({
      page: 'current'
    }).count();


    for (var i = 0; i < api.page.len() - (rowCount === 0 ? 1 : rowCount); i++) {
      $('#example tbody').append($("<tr ><td>&nbsp;</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>"));
    }
  }
});

}

var pageLen = Math.round(($(window).height() - 500) / 40);
var table;

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

initTable(0);

setInterval(function() {

var info = table.page.info();
var pageNum = (info.page < info.pages) ? info.page + 1 : 1;

initTable(pageNum * pageLen);

}, 3000);

});
</script>

</body>
</html>

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    There is no option to do an fade / animation page change in DataTables I’m afraid.

    Allan

Sign In or Register to comment.