onLoad() : void {
// event capturing used
this.grid.element.addEventListener('click', this.collapseAll.bind(this), true);
}
collapseAll (args): void {
let tgt = args.target;
if (tgt.closest('.e-grid').getAttribute('id') !== this.grid.element.getAttribute('id')) {
// for child grid
if(tgt.classList.contains('e-dtdiagonalright') || tgt.classList.contains('e-detailrowcollapse')) {
tgt.closest('.e-grid').ej2_instances[0].detailRowModule.collapseAll();
}
} else if(tgt.classList.contains('e-dtdiagonalright') || tgt.classList.contains('e-detailrowcollapse')) {
// for Parent Grid Alone
this.grid.detailRowModule.collapseAll();
}
}
<div class="control-section">
<ejs-grid #grid [dataSource]='data' (load)='onLoad($event)' [childGrid]="childGrid" >
. . .
. . ..
</ejs-grid>
</div>
|
collapseAll (args): void {
let tgt = args.target;
if (tgt.closest('.e-grid').getAttribute('id') !== this.grid.element.getAttribute('id')) {
// for child grid
if(tgt.classList.contains('e-dtdiagonalright') || tgt.classList.contains('e-detailrowcollapse')) {
var inst = tgt.closest('.e-grid').ej2_instances[0];
console.log(inst.getRowObjectFromUID(tgt.closest('.e-row').getAttribute('data-uid')))
inst.detailRowModule.collapseAll();
} else if (tgt.classList.contains('e-dtdiagonaldown') || tgt.classList.contains('e-detailrowexpand')) {
var inst = tgt.closest('.e-grid').ej2_instances[0];
console.log(inst.getRowObjectFromUID(tgt.closest('.e-row').getAttribute('data-uid')));
}
} else if(tgt.classList.contains('e-dtdiagonalright') || tgt.classList.contains('e-detailrowcollapse')) {
console.log(this.grid.getRowObjectFromUID(tgt.closest('.e-row').getAttribute('data-uid')));
// for Parent Grid Alone
this.grid.detailRowModule.collapseAll();
} else if (tgt.classList.contains('e-dtdiagonaldown') || tgt.classList.contains('e-detailrowexpand')) {
console.log(this.grid.getRowObjectFromUID(tgt.closest('.e-row').getAttribute('data-uid')));
}
}
|