File tree Expand file tree Collapse file tree 3 files changed +21
-8
lines changed
projects/igniteui-angular/src/lib/grids
src/app/hierarchical-grid Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -2798,14 +2798,15 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
27982798 const extractForOfs = pipe ( map ( ( collection : any [ ] ) => collection . filter ( elementFilter ) . map ( item => item . virtDirRow ) ) ) ;
27992799 const rowListObserver = extractForOfs ( this . _dataRowList . changes ) ;
28002800 const summaryRowObserver = extractForOfs ( this . _summaryRowList . changes ) ;
2801-
2802- combineLatest ( [ rowListObserver , summaryRowObserver ] ) . pipe ( takeUntil ( this . destroy$ ) )
2803- . subscribe ( ( [ row , summary ] ) => this . _horizontalForOfs = [ ...row , ...summary ] ) ;
2804-
2805- this . _horizontalForOfs = [
2806- ...this . _dataRowList . filter ( elementFilter ) . map ( item => item . virtDirRow ) ,
2807- ...this . _summaryRowList . filter ( elementFilter ) . map ( item => item . virtDirRow )
2808- ] ;
2801+ const resetHorizontalForOfs = ( ) => {
2802+ this . _horizontalForOfs = [
2803+ ...this . _dataRowList . filter ( elementFilter ) . map ( item => item . virtDirRow ) ,
2804+ ...this . _summaryRowList . filter ( elementFilter ) . map ( item => item . virtDirRow )
2805+ ] ;
2806+ } ;
2807+ rowListObserver . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( resetHorizontalForOfs ) ;
2808+ summaryRowObserver . pipe ( takeUntil ( this . destroy$ ) ) . subscribe ( resetHorizontalForOfs ) ;
2809+ resetHorizontalForOfs ( ) ;
28092810 }
28102811
28112812 /**
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ <h4 class="sample-title">Sample One</h4>
7070
7171 < h4 class ="sample-title "> Sample two</ h4 >
7272 < div class ="sample-actions ">
73+ < button igxButton ="raised " (click) ="enableSummary() "> Enable Summaries</ button >
7374 < button igxButton ="raised " (click) ='setterBindingChange() '> Set rowSelectable via binding</ button >
7475 < button igxButton ="raised " (click) ='setterChange() '> Set rowSelectable via setter on 1st layout</ button >
7576 < button igxButton ="raised " (click) ='testApis() '> Test APis</ button >
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ export class HierarchicalGridSampleComponent {
3333 @ViewChild ( 'hGrid' , { static : true } )
3434 hGrid : IgxHierarchicalGridComponent ;
3535
36+ @ViewChild ( 'hGrid2' , { static : true } )
37+ hGrid2 : IgxHierarchicalGridComponent ;
38+
3639 constructor ( private cdr : ChangeDetectorRef ) {
3740 // this.localData.push({ ID: -1, Name: ''});
3841 // for (let i = 0; i < 10000; i++) {
@@ -60,6 +63,14 @@ export class HierarchicalGridSampleComponent {
6063 this . localData [ 2 ] . childData [ 1 ] . hasChild = false ;
6164 }
6265
66+ public enableSummary ( ) {
67+ const childGrid = this . hGrid2 . hgridAPI . getChildGrids ( false ) [ 0 ] ;
68+ this . hGrid2 . getColumnByName ( 'ID' ) . hasSummary = true ;
69+ if ( childGrid ) {
70+ childGrid . getColumnByName ( 'ID' ) . hasSummary = true ;
71+ }
72+ }
73+
6374 ngAfterViewInit ( ) {
6475 this . cdr . detectChanges ( ) ;
6576 }
You can’t perform that action at this time.
0 commit comments