formatting style cell content server side on ajax reload

formatting style cell content server side on ajax reload

rikikirikiki Posts: 3Questions: 1Answers: 0

I need to apply style to cell content depend from same db variables visible only on server side ....
the simply way for this could be to have a ajax "response" in html format.

I have try it but the table send one alert can't reinizialize etc etc.

somebody know a solution for this problem?

thank you

Answers

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    Sample code please. Specific error, etc.

    Can you add the needed data to the ajax response? Even if you do not include it in the columns definition, DT can access the jSON response to read the data and apply the logic.

  • rikikirikiki Posts: 3Questions: 1Answers: 0

    Thank you for your suggestion
    It works fine

  • rikikirikiki Posts: 3Questions: 1Answers: 0

    below the code where aData[8] is not include in the columns

     "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
        if (aData[5].length>4) {
          $('td:eq(5)', nRow).html( '<a href="https://wpt.italiaonline.it/results.php?test='+aData[5]+'" target="_blank">'+aData[5]+'</a>' );
        }
        var min_elapsed = parseInt(aData[4].substr(3,2),10) - parseInt(aData[2],10);
        if (min_elapsed > 10) {
            $('td:eq(7)', nRow).addClass('red');
        } else {
            if (min_elapsed > 5) {
                $('td:eq(7)', nRow).addClass('orange');
            }
        }
        if (aData[8]=='loc_inactive') {
            $('td:eq(1)', nRow).addClass('red_nobold');
        }
     }
    
This discussion has been closed.