my table columns are amount, price, value, date, notes
addCommas and round are formatting functions
the json data looks like this
[{"amount":"19905405",
"price":"3.7",
"value":"736500",
"date":"2012-02-29",
"notes":""
},
{"amount":"10000000",
"price":"2",
"value":"200000",
"date":"2011-12-05",
"notes":"test one only"
}]
inside the $.ajax({... success:function(store){... this is my javascript loop to draw the table
$("#table_a").empty();
var table = '<tbody><tr><td style="ba.....rest of header row string';
$.each(store, function(row, i) {
table += '<tr>';
table += '<td><span>' + addCommas(round(i/1000000,2)) + "m" + '</span></td>';
table += '<td><span>' + i + '</span></td>';
table += '<td><span>' + "$" + addCommas(round(i/1000000,2)) + "m" + '</span></td>';
table += '<td><span>' + i + '</span></td>';
table += '<td><span>' + i + '</span></td>';
table += '</tr>';
});
table += '</tr></tbody>';
$("#table_a").append(table);
the end result currently looks like this

how do I get the loop right to add formatting to the cell data ?
addCommasorroundfunction so 1000000 becomes $1m. the code above results inNaNmin table cells where formatting funcs apply, and[object Object]whereiis not formatted.addCommasorround, they work fine