Posted 26 October 2022, 1:59 pm EST - Updated 26 October 2022, 2:06 pm EST
I’m trying to find a way to improve the performance of expanding multiple nested FlexGrid details at once.
The ideal scenario is: when you click on a parent RowCol (P) within a FlexGrid, all its details expand, and those details become recognized as new RowCol objects. If those nested RowCol objects contain details, then those should be expanded too. The tree expansion visual is shown with this visual below:
The functionality is working, but performance is not optimal with the way data binding works on FlexGrid rows, so I’m looking to improve performance.
2 things happen when clicking on a FlexGrid item:
-
showDetail() is called to show the current RowCol details.
-
initializeGrid() is called to expand multiple RowCol objects and their details upon click.
1. showDetail()
HTML
<a ... (click)="showDetail(parentDetailProvider, row, false)"></a>
TypeScript
public showDetail(parentDetailProvider: wjGridDetail.FlexGridDetailProvider, row: any, hideOthers?: boolean) {
dp.showDetail(row, hideOthers);
this.gridSelectionService.clearSelectionFromGrids(parentDetailProvider.grid);
}
2. initializedGrid()
HTML
<wj-flex-grid #grid [itemsSource]="item.details" (initialized)="initializeGrid(gridScenarios, $event, thisDetailProvider)">
TypeScript
public initializeGrid(grid, eve, thisDetailProvider?: wjGridDetail.FlexGridDetailProvider) {
if (thisDetailProvider!= null) {
setTimeout(() => {
try {
for (var t = 0; t < grid.rows.length; t++) {
if (thisDetailProvider.isDetailAvailable(t)) {
thisDetailProvider.showDetail(t);
this.gridSelectionService.clearSelectionFromGrids(thisDetailProvider.grid);
}
}
} catch (err) { console.log(err); }
}, 100);
}
}
That summarizes the structure, and the functionality is working. Here are some other things I’ve tried but haven’t done anything to improve performance time or reduce latency:
-
Turn expandRows() into an async function.
-
Put all the FlexGrid objects into an array of Promises to take advantage of parallel processing.
The question now is about improving performance, and if anyone could offer some insight/a direction into more efficiently expanding multiple RowCol objects (FlexGrid details) nested within a given RowCol.