We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Column Template with Jinja2?

Thread ID:

Created:

Updated:

Platform:

Replies:

120941 Oct 28,2015 03:15 PM Oct 29,2015 12:39 AM JavaScript 4
loading
Tags: ejGrid
Bruce Van Horn
Asked On October 28, 2015 03:15 PM

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.

Bruce Van Horn
Replied On October 28, 2015 03:37 PM

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;
}
}
}
});

Bruce Van Horn
Replied On October 28, 2015 03:39 PM

Dude, that was awesome!  Somebody ought to give you a job doing this.

Bruce Van Horn
Replied On October 28, 2015 03:40 PM

Thank you.

Sellappandi Ramu [Syncfusion]
Replied On October 29, 2015 12:39 AM

Hi Bruce Van Horn,

Thanks for the update.

Please get back to us if you have any queries. We are happy to assist you.

Regards,
Sellappandi R

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;