If condition in jsrendertemplate

69 Views Asked by At

Hi i have use the following code snippet in js render template.

"<td  class={{if IsSelected}}" + "e-rowcell e-selectionbackground" + "{{else}}e-rowcell{{/if}}>"

In this case e-selectionbackground did not add to the Class if rendered data contains IsSelected as true.

How to resolve this problem

1

There are 1 best solutions below

0
On

Looks like you don't have quotes around the class. It needs to be:

   "<td  class='{{if IsSelected}}"
 + "e-rowcell e-selectionbackground"
 + "{{else}}e-rowcell{{/if}}'>

or

   "<td  class={{if IsSelected}}"
 + "'e-rowcell e-selectionbackground'"
 + "{{else}}'e-rowcell'{{/if}}>