Skip to content

Commit 39b1a02

Browse files
committed
chore(hgrid): Apply review notes
1 parent b30a517 commit 39b1a02

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3007,18 +3007,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
30073007
}
30083008

30093009
public set expansionStates(value) {
3010-
value = this.filterExpansionStates(value);
30113010
this._expansionStates = new Map<any, boolean>(value);
30123011
this.expansionStatesChange.emit(this._expansionStates);
30133012
if (this.gridAPI.grid) {
30143013
this.cdr.detectChanges();
30153014
}
30163015
}
30173016

3018-
protected filterExpansionStates(value) {
3019-
return value;
3020-
}
3021-
30223017
/**
30233018
* Expands all rows.
30243019
* @example

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-api.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ export class IgxHierarchicalGridAPIService extends GridBaseAPIService<IgxGridBas
112112

113113
public allow_expansion_state_change(rowID, expanded): boolean {
114114
const rec = this.get_rec_by_id(rowID);
115+
const grid = (this.grid as any);
116+
if (rec.expanded === expanded ||
117+
(grid.hasChildrenKey && !rec[grid.hasChildrenKey])) {
118+
return false;
119+
}
115120
return !!rec && this.grid.expansionStates.get(rowID) !== expanded;
116121
}
117122

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -414,19 +414,6 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
414414
}
415415
}
416416

417-
protected filterExpansionStates(expStates: Map<any, boolean>) {
418-
const results = new Map<any, boolean>(expStates);
419-
if (this.hasChildrenKey) {
420-
expStates.forEach((value, item) => {
421-
const rec = this.primaryKey ? this.data.find(x => x[this.primaryKey] === item) : item;
422-
if (!rec[this.hasChildrenKey]) {
423-
results.delete(item);
424-
}
425-
});
426-
}
427-
return results;
428-
}
429-
430417
protected onColumnsChanged(change: QueryList<IgxColumnComponent>) {
431418
this.updateColumnList();
432419
const cols = change.filter(c => c.gridAPI.grid === this);

0 commit comments

Comments
 (0)