accessing the columns with data:NULL inside rowCallback function

accessing the columns with data:NULL inside rowCallback function

Khalid TeliKhalid Teli Posts: 251Questions: 71Answers: 0

I want to change the colour of some cells in column based on the cell values in another column.
I have been able to do it by using rowCallback function as follows :

   rowCallback: function(row, data, index){
    if((data.contract_bal.opt_two!='0') && (data.contract_bal.opt_three=='0') ){
        $(row).find('td:eq(3)').css('color', 'red');            }

    }     

I the code above i use data.contract_bal.opt to acces the columns inside object data.
However, I want to access the columns shown below which is created on client side . How would I include this inside rowCallback function?

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

                     {

                      var start_date = new Date(row.contract_bal.start_date);
                      var end_date = new Date(row.contract_bal.end_date);
                      var today = new Date() ;

                      var sec_start = start_date.getTime();
                      var sec_end = end_date.getTime();
                      var sec_today = today.getTime();


                      var total = sec_end - sec_start;
                       var elapsed = sec_today - sec_start;
                       var percent = Math.round(((total-elapsed)/total * 100)) + '%';



                        return percent ;



                    }},

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.