addClass / render / ajax.reload

addClass / render / ajax.reload

Romain974Romain974 Posts: 2Questions: 0Answers: 0

Hello,

I use API
when i load the page the first time my code works fine but when ajax.reload it deletes my addClass.

In my console everything in render is loaded twice.

setInterval( function () {
    table.ajax.reload( null, false ); // user paging is not reset on reload


}, 30000 );

var table = $('#example').DataTable( {

        "aaSorting": [[0,'desc']],
        "paging": false,
        ajax: "data.json",
//      pageLength : 50 ,

        dom: "Bfrtip",
        ajax: {
            url: "/api_table/controllers/join.php?date=<?php echo $datepost."&filtre=".$filtre; ?>",
            type: 'POST'
        },
        serverSide: true,
        columns: [

............................

{ data: "commande.attente", //status

render: function ( data, type, row, meta ) {

if (data == '1') { 

console.log(row.DT_RowId);   <<< this one is run 2 times

$( 'td', '#'+row.DT_RowId ).addClass( 'red' );  <<<< 1st time it works then no


Do you have an idea of the problem please?

Replies

This discussion has been closed.