Quantcast
Channel: BrainStorage
Viewing all articles
Browse latest Browse all 102

Kendo Grid Column Template With Multiple Attributes

$
0
0

It is pretty well documented (see below) how to use the ternary operator in Kendo Grid Column Templates, for instance to conditionally check or disable a checkbox.

I was able to get that functionality working easily, but struggled when I needed to combine both the checked and disabled attributes within a single condition expression. I could not get the syntax right and kept getting template compile runtime errors.

After further research, I discovered an example that showed that it was necessary to enclose the condition expression within escaped quotes for it to compile. Below is an example of my grid columns, including the inline template.

kendo template

Kendo Checkbox Column Template with multiple attributes (red)

In my case, when the IsChecked property is true, the checkbox should be both checked and disabled. The statement underlined in red shows the technique for combining multiple attributes, as well as the standard syntax for a single attribute (data.IsSelectable), which is underlined in blue.

Helpful resources:

General checkbox example (see the Fiddle)

Escaped-quote syntax example (see Jan. 9, 2014 post)


Filed under: ASP.Net Tagged: attribute, Column, grid, kendo UI, multiple, template, ternary

Viewing all articles
Browse latest Browse all 102

Trending Articles