Add Total row to channellist

This commit is contained in:
calzoneman 2013-05-11 14:53:33 -04:00
parent 0f2c17b828
commit aba806018c
1 changed files with 8 additions and 0 deletions

View File

@ -98,6 +98,7 @@
} }
return y - x; return y - x;
}); });
var total = 0;
for(var i = 0; i < data.length; i++) { for(var i = 0; i < data.length; i++) {
var d = data[i]; var d = data[i];
var tr = $("<tr/>").appendTo($("#channeldata")); var tr = $("<tr/>").appendTo($("#channeldata"));
@ -106,8 +107,15 @@
.text(d.name) .text(d.name)
.appendTo(name); .appendTo(name);
$("<td/>").text(d.usercount || 0).appendTo(tr); $("<td/>").text(d.usercount || 0).appendTo(tr);
total += (d.usercount || 0);
$("<td/>").text(d.title || "-").appendTo(tr); $("<td/>").text(d.title || "-").appendTo(tr);
} }
var tr = $("<tr/>").appendTo($("#channeldata"));
$("<td/>").text("Total").appendTo(tr);
$("<td/>").text(total).appendTo(tr);
$("<td/>").appendTo(tr);
}); });
} }
function createCookie(name,value,days) { function createCookie(name,value,days) {