In your examples regarding column templates you use {{ }} to delineate placeholders for the template. Unfortunately for me, the template engine I am using for my site, Jinja2, also uses those symbols. Jinja2 is going to intercept the template and throw an error. Is there any way to re-define the symbols that are used in the template engine for the column template? Is there a way I could use, say {! !}? Or some other combination is fine, so long as it doesn't collide with Jinja2.
Never mind - I figured out how to work around it using queryCellInfo and changing the inner html rather than using a column template.
$("#grid").ejGrid({
dataSource: data['health_details'],
allowPaging: true,
allowGrouping: true,
groupSettings: {groupedColumns: ["category", "alert_level"]},
columns: [
{field: "category", headerText: "Category", width: 200},
{field: "alert_level", headerText: "Alert Level", width: 130},
{field: "description", headerText: "Description"}
],
queryCellInfo: function (args) {
var value = args.text.replace(",", "");
switch (args.column.headerText) {
case "Category":
switch (parseFloat(value)) {
case 0:
args.cell.innerHTML = '<img src="../static/img/Health-0.png"/>';
break;
case 1:
args.cell.innerHTML = '<img src="../static/img/Health-1.png"/>';
break;
case 2:
args.cell.innerHTML = '<img src="../static/img/Health-2.png"/>';
break;
case 3:
args.cell.innerHTML = '<img src="../static/img/Health-3.png"/>';
break;
default:
args.cell.innerHTML = '<img src="../static/img/Health-4.png"/>';
break;
}
}
}
});