Reputation: 809
Hi I am using Kendo template as follows:
<div id="ModelListView"></div>
<div class="section group fr">
#if(MODEL != null){#
#if(ACTIVE_MODELS_COUNT > 0 && ACTIVE_MODELS_COUNT != 'null'){#
<input class="ModelCheckBox" type="checkbox" checked/>
#}
else {#
<input class="ModelCheckBox" type="checkbox" unchecked />
#}#
<label>#:MODEL#</label>
<label class="Model_ID" style="visibility:hidden;">#:MODEL_ID#</label>
@*<input class="Model_ID" type="hidden" value= #:MODEL_ID #/>*@
#}#
</div>
$("#ModelListView").kendoListView({
template: kendo.template($("#Modeltemplate").html())
});
I want to disable the checkbox based on some condition but not able to do it.
$(".ModelCheckBox").attr('disabled', 'disabled');
Upvotes: 0
Views: 658
Reputation: 4139
Apart from the recommended usage of prop()
instead of attr()
, demonstrated by ezanker, make sure that you disable the checkboxes after they are actually rendered, i.e. do that in the ListView's dataBound
event (similar to another question of yours). Alternatively, include your disable logic in the template markup.
Upvotes: 2