igGrid column template – if statement inside each block
New DiscussionHi! I'm currently trying to initialize an igGrid with some conditional templating, but I'm having some problems when I use "if" statement inside "each" blocks.
Here's my columns variable:
var tempColumns = [
{ headerText: "header1", key: "Cells", dataType: "object", template: "{{each ${Cells} }} {{if ${Cells.Nome} != ''}} ${Cells.Nome} {{else}} no name {{/if}} {{/each}}", width: 250 }
];
My source list:
var tempSourceList2 = [{ Cells : [{ ID : 1, Nome: "Nome1" }, { ID: 2, Nome: "Nome2"}] },
{ Cells : [{ ID: 1, Nome: "" }, { ID: 2, Nome: "Nome3"}] }
];
But the result inside the cells on the rendered igGrid is:
if ( Nome1 != '') {result += args[0]; } else {result += args[1];} if ( Nome2 != '') {result += args[0]; } else {result += args[1];}
if ( != '') {result += args[0]; } else {result += args[1];} if ( Nome3 != '') {result += args[0]; } else {result += args[1];}
Does not the each block supports if statement?
Thank you for your attention.