I am trying to create a template for grid in kendo-ui. Its formatting is conditional...as follows:
dataset sample:
json: [{ "name" :"abc", "link":123 },{ "name" :"def", "link":null}...]
The template should be of the logic:
link === null ? <span>name</span> : <a target="_blank" href="http://mywebsite/name">#=name#</a>
ie conditionally make the text hyperlinked v/s display it as is ( "abc"
should be displayed with a hyperlink while "def"
should not have a hyperlink).
I am able to get the unconditional way of template working with always make the text as hyperlink as follows:
var nameTemplate = '<a target="_blank" href="http://mywebsite/#=name#">#=name#</a>';
But cannot get the template with the above ternary operator logic to work
Thoughts?
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.