new ATable({
dataFunction : function (atable) {
var date = new Date();
date.setFullYear(2008, 11, 24);
var date2 = new Date();
date2.setFullYear(2009, 4, 15);
atable.receivedData([
["Jessica Student", 3.674, date],
["Bill Average", 2.53, date],
["Pete Perfect", 4.0, date2]
]);
},
cellClasses : "italic", // Apply the italic class to all cells in the table
formatter : function (val, row, col, colName) {
if (colName === "name") {
var parts = val.split(" ", 2);
return parts[1] + ", " + parts[0];
}
else if (colName === "gpa") {
return (Math.round(val * 10) / 10).toFixed(1);
}
else if (colName === "graddate") {
return val.toDateString();
}
return val;
},
columns : [
{name : "name", label : "Name", width : 100},
{name : "gpa", label : "GPA", width : 50},
// Apply the bold and yellow classes to cells in this column (overriding the italic class)
{name : "graddate", label : "Grad Date", width : 150, cellClasses : "bold yellow"}
],
el : "#formatAndStyle",
// height in pixels is required
height : 400
}).render();