File tree Expand file tree Collapse file tree 3 files changed +5
-18
lines changed
projects/igniteui-angular/src/lib/grids Expand file tree Collapse file tree 3 files changed +5
-18
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments