Hi,
I am using grid and child grid. When I update the data within the Child Grid, I refresh the Grid, but with the refresh, the child grid that i have opened, is closed.
In this Stackblitz when I click on "Update Child" button with first child grid opened, after refresh the child grid is closed:
https://stackblitz.com/edit/angular-f151306-epoufb?file=app.component.ts
How can i not make it close?
Thanks
|
public indexes;
public expandFlag = false;
// Function for storing expanded parent row indexes
storeExpandedIndexes() {
// Retrieves the expanded row elements
var expandedElements = this.gridObj.element.querySelectorAll('.e-detailrowexpand');
this.indexes = [];
// Parent row indexes of the expanded child Grid are pushed to global variable – “indexes”
expandedElements.forEach(ele => this.indexes.push(parseInt(ele.closest('.e-row').getAttribute("aria-rowindex"))))
// Flag is enabled to denote this case
this.expandFlag = true;
}
// Grid’s dataBound event handler
dataBound() {
if (this.expandFlag && this.indexes.length !== 0) {
// Condition executes on global flag enabled case
// The global flag is disabled so that this case is not executed on consecutive event triggers
this.expandFlag = false;
// Each stored parent row index is expanded
this.indexes.forEach(ind => this.gridObj.detailRowModule.expand(ind));
this.indexes = [];
}
}
btnParent(){
// Here the function for storing the expanded parent row indexes is called
this.storeExpandedIndexes();
...
}
btnChild(){
// Here the function for storing the expanded parent row indexes is called
this.storeExpandedIndexes();
...
} |