rowSelected(args) {
var childAll = args.row.nextElementSibling.querySelectorAll('.e-grid');
for (var i = 0; i < childAll.length; i++) {
var child = args.row.nextElementSibling.querySelectorAll('.e-grid')[i]
.ej2_instances[0];
child.selectionModule.checkSelectAll();
}
} |
// Child Grid’s Selected and Deselected event
rowSelected: function (args) {
if (args.target != null) {
if (args.data.length === args.target.closest('.e-grid').ej2_instances[0].pageSettings.totalRecordsCount) {
var parentInstances = (document.getElementById(args.target.closest('.e-grid').ej2_instances[0].parentDetails.parentID) as any).ej2_instances[0];
var rowIndex = parentInstances.getRowIndexByPrimaryKey(args.target.closest('.e-grid').ej2_instances[0].parentDetails.parentRowData[parentInstances.getPrimaryKeyFieldNames()[0]]);
this.flag = false;
parentInstances.selectRow(rowIndex); // Select the parent Grid’s specific row
this.flag = true;
}
}
}.bind(this),
rowDeselected: function (args) {
if (args.target != null) {
if (args.data.length === args.target.closest('.e-grid').ej2_instances[0].pageSettings.totalRecordsCount) {
var parentInstances = (document.getElementById(args.target.closest('.e-grid').ej2_instances[0].parentDetails.parentID) as any).ej2_instances[0];
var rowIndex = parentInstances.getRowIndexByPrimaryKey(args.target.closest('.e-grid').ej2_instances[0].parentDetails.parentRowData[parentInstances.getPrimaryKeyFieldNames()[0]]);
parentInstances.selectionModule.addRowsToSelection([rowIndex]); // Deselect the parent Grid’s specific row
}
}
},
}
// Parent Grid’s Selected and Deselected event
rowSelected(args) {
if (this.flag) {
args.row.nextElementSibling.getElementsByClassName('e-detailcell')[0].firstElementChild.ej2_instances[0].selectionModule.checkSelectAll(); // Select the child Grid’s all rows based parent Grid ror
}
}
rowDeselected(args) {
args.row.nextElementSibling.getElementsByClassName('e-detailcell')[0].firstElementChild.ej2_instances[0].selectionModule.clearSelection(); // Clear child Grid’s selection based on parent Grid row
}
|