Skip to content

Commit e1f2c84

Browse files
committed
chore(hgrid): Apply review notes
1 parent ecd5fb5 commit e1f2c84

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
@@ -2961,18 +2961,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
29612961
}
29622962

29632963
public set expansionStates(value) {
2964-
value = this.filterExpansionStates(value);
29652964
this._expansionStates = new Map<any, boolean>(value);
29662965
this.expansionStatesChange.emit(this._expansionStates);
29672966
if (this.gridAPI.grid) {
29682967
this.cdr.detectChanges();
29692968
}
29702969
}
29712970

2972-
protected filterExpansionStates(value) {
2973-
return value;
2974-
}
2975-
29762971
/**
29772972
* Expands all rows.
29782973
* @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)