Hi,
within the columns definition of my grid I want to be able to call a function as the template.
currently I have:
{field: 'recommended', title: 'Recommended', template: '# if(recommended)' + '{# <span class=\"glyphicon glyphicon-ok\"></span> #}' + 'else{# <span class=\"glyphicon glyphicon-ok\"></span> #}#'},
and I would like to have
{field: 'recommended', title: 'Recommended', template: generateFlagTemplate(recommendedFieldValue)},
defining the function as
function generateFlagTemplate(field){
return kendo.template("# if (field)" + "{# <span class=\"glyphicon glyphicon-ok text-success\"></span> #}" + "else {# <span class=\"glyphicon glyphicon-remove text-grey\"></span> #}#");
}
how can I pass the 'recommended' field value to the function?
I would like to have the function because the same template will be used in different places and saves me from having to duplicate my code.
thanks