@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.Columns(col =>
{
col.HeaderText("Template column").Template(true).TemplateID("#columnTemplate").TextAlign(TextAlign.Center).Width(110).Add();
col.Field("City").Width(100).Add();
col.Field("Country").Width(100).Add();
})
.ClientSideEvents(evt=>evt.TemplateRefresh("template"))
)
<script>
function template(args) {
$(args.cell).find("a").text(ej.format(args.data.Freight, "C2"))
}
</script>
<script type="text/x-jsrender" id="columnTemplate">
{{if Freight < 30}}
{{else}}
{{/if}}
</script> |