[Index.cshtml]
@Html.EJS()...DataBound("DataBound").AllowGrouping().GroupSettings(group => { group.CaptionTemplate("#captiontemplate"); }).Render()
<script id="captiontemplate" type="text/x-template">
${field} - ${key} <input id="CheckboxGrid" class="groupcheck" type="checkbox" />
</script>
<script type="text/javascript">
function DataBound(args) {
var chaecksavil = document.getElementsByClassName("groupcheck");
if (chaecksavil.length) {
for (var i = 0; i < chaecksavil.length; i++) {
var checkBoxObj = new ej.buttons.CheckBox({ change: onChange });
checkBoxObj.appendTo(chaecksavil[i]); //Render Syncfusion checkbox component in group caption
}
}
}
function onChange(args) {
var obj = document.getElementsByClassName("e-grid")[0].ej2_instances[0]
var tr = ej.grids.parentsUntil(args.event.target, 'e-groupcaption').parentElement;
let i = tr.rowIndex;
let nextRow;
let indexes = [];
i++;
nextRow = tr.parentElement.rows[i];
while (nextRow.classList.contains('e-row')) { //Perform select/de-select here
if (args.checked && (obj.getSelectedRowIndexes().indexOf(parseInt(nextRow.getAttribute('aria-rowindex'))) > -1)) {
nextRow.getElementsByTagName('input')[0].click()
}
nextRow.getElementsByTagName('input')[0].click()
i++;
nextRow = tr.parentElement.rows[i];
}
}
</script>
|
Hi Can Gunaydin,
Please find the angular grid component sample implemented with the same behavior below,
Let us know if you have any concerns.
Regards,Sujith R