We are using column templates for applying certain styles provided a numeric comparison, for example:
"{{if parseInt(${fldMV})>10000000000}}<div style="background-color:Firebrick;">${fldMV}</div>{{else}}<div style="background-color:Silver;">${fldMV}</div>{{/if}}"
We would now like the use these templates to apply certain styles based on a string or datetime comparisons as well. Could you please provide an example of how to write such a template string?
To clarify: For string comparisons we would like to use expressions such as "equals", "contains", "starts with", "ends with" and their negations.
Hello E Johansson,
With Infragistics Templating Engine for the string column you can use the following syntax:
{{if ${Name}.startsWith('A')}}
{{if !${Name}.startsWith('A')}}
{{if ${Name}.endsWith('A')}}
{{if ${Name}.equals('A')}}
For the date column you can use the following syntax:
{{if (new Date(${ModifiedDate})).getFullYear() === 2004}}
If you still cannot achieve what you want with Infragistics Templating Engine you can also try the jsRender engine support in igGrid or you can try the column formatter function.
P.S.: For performance reasons Infragistics Templating Engine uses regular expressions and will not work in some cases, for example you cannot call external function in it (which you can in jsRender).
Hope this helps,Martin PavlovInfragistics, Inc.