File tree Expand file tree Collapse file tree 2 files changed +18
-14
lines changed
projects/igniteui-angular/src/lib/grids/columns Expand file tree Collapse file tree 2 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
4848 }
4949 }
5050 public get collapsible ( ) {
51- return this . _collapsible ;
51+ return this . _collapsible && this . checkCollapsibleState ( ) ;
5252 }
5353
5454 /**
@@ -240,15 +240,11 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
240240 this . children . forEach ( child => {
241241 child . parent = this ;
242242 } ) ;
243- if ( this . collapsible ) {
244- const cols = this . children . map ( child => child . visibleWhenCollapsed ) ;
245- if ( ! ( cols . some ( c => c === true ) && cols . some ( c => c === false ) ) ) {
246- this . collapsible = false ;
247- return ;
248- }
243+ if ( this . _collapsible && this . checkCollapsibleState ( ) ) {
249244 this . setExpandCollapseState ( ) ;
250245 }
251246 }
247+
252248 /**
253249 * Returns the children columns collection.
254250 * ```typescript
Original file line number Diff line number Diff line change @@ -1026,17 +1026,16 @@ export class IgxColumnComponent implements AfterContentInit {
10261026 this . _visibleWhenCollapsed = value ;
10271027 this . visibleWhenCollapsedChange . emit ( this . _visibleWhenCollapsed ) ;
10281028 if ( this . parent ) {
1029- const cols = this . parent . children . map ( child => child . visibleWhenCollapsed ) ;
1030- if ( ! ( cols . some ( c => c === true ) && cols . some ( c => c === false ) ) ) {
1031- this . parent . collapsible = false ;
1032- } else {
1033- this . parent . collapsible = true ;
1034- }
1029+ if ( ! this . parent . collapsible ) { this . hidden = this . parent . hidden ; return ; }
1030+ this . hidden = this . parent . expanded ? this . _visibleWhenCollapsed : ! this . _visibleWhenCollapsed ;
10351031 }
1032+ if ( this . grid ) {
1033+ this . grid . notifyChanges ( true ) ;
1034+ }
1035+
10361036 }
10371037
10381038 get visibleWhenCollapsed ( ) : boolean {
1039- if ( ! this . parent ) { return ; }
10401039 return this . _visibleWhenCollapsed ;
10411040 }
10421041
@@ -1772,6 +1771,15 @@ export class IgxColumnComponent implements AfterContentInit {
17721771 c . hidden = this . _expanded ? c . visibleWhenCollapsed : ! c . visibleWhenCollapsed ;
17731772 } ) ;
17741773 }
1774+ /**
1775+ * @hidden
1776+ * @internal
1777+ */
1778+ protected checkCollapsibleState ( ) {
1779+ if ( ! this . children ) { return false ; }
1780+ const cols = this . children . map ( child => child . visibleWhenCollapsed ) ;
1781+ return ( cols . some ( c => c === true ) && cols . some ( c => c === false ) ) ;
1782+ }
17751783
17761784 /**
17771785 *@hidden
You can’t perform that action at this time.
0 commit comments