vb.net - Kendo MVC grid ClientTemplate Issue -
i have cell in kendo mvc grid i'd take 1 of 2 info fields depending on value of one:
@(html.kendo().grid(of rtfvm)().name("realtimefinancials") _ .columns(sub(c) c.bound(function(x) x.line.lineitem).htmlattributes(new {.style = "text-align:left"}) c.bound(function(x) x.line.months(0).total).format("0:#,##0}").clienttemplate("#if(data.line.months[0].message == null) {data.line.months[0].total} else {data.line.months[0].message} #") end sub) _ etc
the cell rendering blank every time regardless of result of null comparison. must missing obvious!
the #...# template markup executes js not output anything.
instead, seek #:...# or #=...# both output value html, or template:
#if(data.line.months[0].message == null) {##:data.line.months[0].total##} else {##:data.line.months[0].message##}# (it looks weird on 1 line, if insert line breaks create more sense:)
#if(data.line.months[0].message == null) {# #:data.line.months[0].total# #} else {# #:data.line.months[0].message# #}# i think template might work:
#: data.line.months[0].message ?? data.line.months[0].total # which utilize null-coalescing operator utilize total in case message falsey.
vb.net kendo-ui kendo-grid kendo-asp.net-mvc
No comments:
Post a Comment