Paginacion does not load images

Paginacion does not load images

Jack_ChasezJack_Chasez Posts: 3Questions: 1Answers: 0

Hello everyone, it turns out that I have a table that I call from a database and this is in a table, I call that through a json, everything turns out well, I could even resolve to upload the photos, when I went to the next record or click on the next page do not upload the photos of the other records this is what I do, please I have very bad English, sorry

/=============================================
LOAD TABLE
=============================================
/
$(document).ready(function() {
var table = $('.tablaUsuarios').DataTable( {
"ajax": "ajax/datatable-usuarios.ajax.php",
"columnDefs": [

    {
        "targets": -5,
        "data": null,
        "defaultContent": '<img class="img-thumbnail imgTabla" width="40px">'
    },

    {
        "targets": -1,
        "data": null,
        "defaultContent": '<div class="btn-group">  <button class="btn btn-warning btnEditarUsuario" idUsuario="" data- toggle="modal" data-target="#modalEditarUsuario"><i class="fa fa-pencil"></i></button>  <button class="btn btn-danger btnEliminarUsuario" idUsuario=""><i class="fa fa-times"></i></button> </div>'
    }

  ]

})

/=============================================
LOAD IMAGE TABLE - WORKING
=============================================
/
setTimeout(function(){

var imgTabla = $(".imgTabla");
//console.log("imgTabla", imgTabla);

for(var i = 0; i < imgTabla.length; i ++){

var data = $('.tablaUsuarios').DataTable().row($(imgTabla[i]).parents("tr")).data();
$(imgTabla[i]).attr("src", data[3]); 

}

},300)
/=============================================
LOAD IMAGE PAGINATION NO WORKING
=============================================
/

$(".dataTables_paginate")click(function(){

var imgTabla = $(".imgTabla");
//console.log("imgTabla", imgTabla);

for(var i = 0; i < imgTabla.length; i ++){

//var data = $table.row( $(imgTabla[i]).parents("tr")).data();
var data = $('.tablaUsuarios').DataTable().row($(imgTabla[i]).parents("tr")).data();
//$('#myTable').DataTable().row(row).data();
  //console.log("data", data);

$(imgTabla[i]).attr("src", data[3]); 

}

})

Answers

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770

    LOAD IMAGE PAGINATION NO WORKING

    Looks like you have a syntax error:

    $(".dataTables_paginate")click(function(){

    You are missing a . preceding click:

    $(".dataTables_paginate").click(function(){

    Kevin

  • Jack_ChasezJack_Chasez Posts: 3Questions: 1Answers: 0

    OMG!!,yes, but it is not the point ... xD, when transcribing it, do not write it down, it was my mistake, that is not the problem ...

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770

    If its still not working then please post a link to your page or a test case replicating the issue. This will allow us to help you troubleshoot.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.