JQuery templating
Is it possible in a JQuery templat开发者_如何学Pythone to specify an particular image depending upon the value in the field (in this case it is a boolean field {MainYN} and I want to show a tick image if the value is true and a cross image if the value is false)?
unfortunatly JQuery template makes a simple replace of {Variable} with the values inserted in the ArrayValue passed to the template function. I've solved this problem passing the full path of the image to the template.
There are a couple of ways this can be accomplished but the general steps are the same.
In your template, just add some if logic:
{{if MainYN === true}}
<img src="tick.png" />
{{else}}
<img src="cross.png" />
{{/if}}
精彩评论