Answer the question
In order to leave comments, you need to log in
How to find error in JS (dataTables)?
Good afternoon, the console swears at
Uncaught SyntaxError: Unexpected token ) stattables.js:168
I selected the line.
var stat_options = $.extend({'sAjaxSource':"/dashboard/graph/", "aoColumns": [
{ "mData": "date" },
//{"mData":"clicks"},
{ "mData":"unique_clicks" },
{ "mData":"events_count" },
{ "mData":"approved" },
{ "mData":"pending" },
{ "mData":"rejected" },
{ "mData":"cpc" },
{ "mData":"ltr" },
{ "mData":"approval_rate" },
//{"mData":"total_revenue"},
//{"mData":"rejected_revenue"},
{ "mData":"pending_revenue" },
{ "mData":"approved_revenue" }
], "fnFooterCallback": function( nRow, aaData, iStart, iEnd, aiDisplay ) {
var iTotal = 0
var iTotal2 = 0
for ( var i=0 ; i<aaData.length ; i++ )
{
iTotal += aaData[i][9]*1;
iTotal2 += aaData[i][10]*1;
}
var nCells = nRow.getElementsByTagName('th');
nCells[9].innerHTML = parseInt(iTotal);
nCells[10].innerHTML = parseInt(iTotal2);
<b> });</b>
},tables_options);
Answer the question
In order to leave comments, you need to log in
You have some kind of perfect hell in formatting. Good code formatting is the key to avoiding syntax errors.
var stat_options = $.extend({
"sAjaxSource": "/dashboard/graph/",
"aoColumns": [
{ "mData": "date" },
// {"mData":"clicks"},
{ "mData":"unique_clicks" },
{ "mData":"events_count" },
{ "mData":"approved" },
{ "mData":"pending" },
{ "mData":"rejected" },
{ "mData":"cpc" },
{ "mData":"ltr" },
{ "mData":"approval_rate" },
// {"mData":"total_revenue"},
// {"mData":"rejected_revenue"},
{ "mData":"pending_revenue" },
{ "mData":"approved_revenue" }
],
"fnFooterCallback": function( nRow, aaData, iStart, iEnd, aiDisplay ) {
var iTotal = 0;
var iTotal2 = 0;
for ( var i=0 ; i<aaData.length ; i++ ) {
iTotal += aaData[i][9]*1;
iTotal2 += aaData[i][10]*1;
}
var nCells = nRow.getElementsByTagName('th');
nCells[9].innerHTML = parseInt(iTotal);
nCells[10].innerHTML = parseInt(iTotal2);
});
}, tables_options);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question