I am having kendo grid in detailRowTemplate of kendo grid(Primary Grid). In my primary Grid template, I have checkAll Checkbox. If I check that checkbox, I want to check all the checkboxes in the detailGrid related to that particular row. Right now, I am using class to check all checkboxes. So, it is checking all checkboxes for all the rows of the primary Grid. I want to check only the Grid that is related to Primar Grid detail Temlplate. How can I do this ? Below is my code
//Primary Grid
$("#grid").kendoGrid({
dataSource: dataSource,
rowTemplate: kendo.template($("#Template").html()),
detailTemplate: kendo.template($("#gridtemplate").html()),
detailInit: detailInit,
dataBound: function () {
},
columns: [
{ field: "Id", hidden: true },
{ field: "Name", title: "Name" },
{ field: "Read", title: "Read" }
]
});
//Detail Template Grid
detailRow.find(".SiteGrid").kendoGrid({
dataSource: dataSource,
rowTemplate: kendo.template($("#SiteTemplate").html()),
columns: [
{ field: "Id", hidden: true },
{ field: "Name", title: "Site", width: 350 },
{ field: "Read", title: "Read", }
]
});
//Detail Grid Template
<script type="text/x-kendo-template" id="gridtemplate">
<div class="SiteGrid">
</div>
</script>
//Primary Grid Template
<script type="text/x-kendo-template" id="Template">
<tr class="k-master-row k-alt">
<td class="k-hierarchy-cell"><a href="\#" class="k-icon k-plus"></a></td>
<td> #= Name # </td>
<td><input type="checkbox" name="#: Id #" value="Select All" onclick="CheckCheckboxes(); return true;" /></td>
</tr>
</script>
//Detail Grid Template
<script type="text/x-kendo-template" id="SiteTemplate">
<tr class='k-alt'>
<td>#: Name #</td>
<td>
#if(AccessType == 'Read') { #
<input type="radio" name="#: Id #" class="read" checked="checked" />
#}else{#
<input type="radio" name="#: Id #" class="read" />
# } #
</td>
</tr>
</script>
//Checking Check boxes
<script>
function CheckCheckboxes() {
$('.read').prop('checked', true);
}
</script>
//Primary Grid
$("#grid").kendoGrid({
dataSource: dataSource,
rowTemplate: kendo.template($("#Template").html()),
detailTemplate: kendo.template($("#gridtemplate").html()),
detailInit: detailInit,
dataBound: function () {
},
columns: [
{ field: "Id", hidden: true },
{ field: "Name", title: "Name" },
{ field: "Read", title: "Read" }
]
});
//Detail Template Grid
detailRow.find(".SiteGrid").kendoGrid({
dataSource: dataSource,
rowTemplate: kendo.template($("#SiteTemplate").html()),
columns: [
{ field: "Id", hidden: true },
{ field: "Name", title: "Site", width: 350 },
{ field: "Read", title: "Read", }
]
});
//Detail Grid Template
<script type="text/x-kendo-template" id="gridtemplate">
<div class="SiteGrid">
</div>
</script>
//Primary Grid Template
<script type="text/x-kendo-template" id="Template">
<tr class="k-master-row k-alt">
<td class="k-hierarchy-cell"><a href="\#" class="k-icon k-plus"></a></td>
<td> #= Name # </td>
<td><input type="checkbox" name="#: Id #" value="Select All" onclick="CheckCheckboxes(); return true;" /></td>
</tr>
</script>
//Detail Grid Template
<script type="text/x-kendo-template" id="SiteTemplate">
<tr class='k-alt'>
<td>#: Name #</td>
<td>
#if(AccessType == 'Read') { #
<input type="radio" name="#: Id #" class="read" checked="checked" />
#}else{#
<input type="radio" name="#: Id #" class="read" />
# } #
</td>
</tr>
</script>
//Checking Check boxes
<script>
function CheckCheckboxes() {
$('.read').prop('checked', true);
}
</script>