javascript - How to multiply Data in Datatables? -


how multiply data in datatables ? have datatables , javascript this:

$('#xxdata').datatable( {         "destroy": true,         "processing": true,         "ajax": {             url  : "xxreport.php",             type : 'get',             data : {                 datedari : splitrange[0].trim(),                 datesampai : splitrange[1].trim()         }         },         "columns": [                 { "data": "offername" },                 { "data": "offercountry" },                 { "data": "visits" },                 { "data": "conversions" },                 { "data": "profit"}         ] } ); 

i want multiply data in { "data": "profit"}
maybe { "data": "profit" * 0.7}

can change data in datatables want? or can give other solutions?

thank you.

you can use columns.render option (documented here) this.

"columns": [             { "data": "offername" },             { "data": "offercountry" },             { "data": "visits" },             { "data": "conversions" },             { "data": "profit",               "render": function (data) {                             return data * 0.7;                         }             }     ] 

in case, data in function signature represents data cell. there other options can passed function, in case these not need included since such simple operation. see documentation link if ever want expand more complicated rendering function


Comments