Reputation: 3892
I am using checkboxes inside kendo grid. I need to show and hide checkboxes dynamically using one flag , also I need to check/uncheck checkboxes dynamically using another flag.
Hence I used a template like this
template:
<input #= EQUS ? '' : style='visibility:hidden' # type='checkbox' class='checkbox' #= IsEquityUS ? checked='checked' : '' #/>
where EQUS flag is used to show/hide checkboxes IsEquityUS flag is used to check/uncheck checkboxes
The problem is though if EQUS is false, checkbox is not hiding. So can anyone tell me the solution how to accomplish this functionality, and why the above code is not working.
Thanks in advance
Upvotes: 0
Views: 2468
Reputation: 453
If both isEquityUS and EQUS are part of the model of kendogrid, then instead of using inline template, you can define the template in your html.
<script id="template" type="text/kendo-template">
#if(EQUS != '') { #
<input type="checkbox" #= data.IsEquityUS ? checked="checked" : "" # />
# } #
</script>
In the grid column, provide this template as shown below:
columns: [
{ field: "EQUS", Title: "EQUS", width: 150 },
{
template: $("#template").html(),
}
]
check the fiddle http://jsfiddle.net/Hfk3Q/17/
Upvotes: 1