sorting icon columns after update columns by json

sorting icon columns after update columns by json

thiago_jobconvothiago_jobconvo Posts: 1Questions: 0Answers: 0

i have a databe and one columns status , this column i update by ajax after load all page ,
because have a function vary large and after a change my columns with the gyphicon , i can't
sorting this columns ....

how i can fix it ?

this is code i used for update my values.

$(function (){
       
        var candidate_list = $('table td.status_teste').map(function(){
        return parseInt(this.id)
        }).get();

    console.log(candidate_list)

    url  =  $('#url_hidden').attr('data-url')
    $.ajax({
            url: url,
            type: 'GET',
            dataType: 'json',
            data: {candidates:JSON.stringify(candidate_list)},
            success: function(data){

        
            $.each(data, function(index, value) {


                if(value.has == true){
                  if(value.complete == true){
                    $('#'+value.user).find('img').remove()
                    $('#'+value.user).prepend('<spam class="text-success glyphicon glyphicon-ok-circle"     style="font-size:1.5em"></spam>')
                 
                  }else{
                      $('#'+value.user).find('img').remove()
                      $('#'+value.user).prepend('<spam class="text-warning glyphicon glyphicon-exclamation-sign" style="font-size:1.5em"></spam>')

                  }
                }else{
                    $('#'+value.user).find('img').remove()
                    $('#'+value.user).prepend('<spam class="text-danger glyphicon glyphicon-remove-circle" style="font-size:1.5em"></spam>')

                }

            });



              var  datatable =  $('#tbl').DataTable();
              datatable.redraw();




              
            }
    });
});

Replies

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    I don't believe there is a Datatables API redraw(). Maybe you meant to use draw() on line 42, for example: datatable.draw();.

    You probably have a console error indicating redraw is not a function stopping the script.

    Kevin

This discussion has been closed.