-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(table): not picking up indirect descendant defs #17340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(table): not picking up indirect descendant defs #17340
Conversation
Fixes the table not picking descendants that aren't direct descendants. Currently this isn't a huge problem, however with Ivy it'll become an issue that'll prevent consumers from setting an `ngIf` around the defs. Fixes angular#17339.
@@ -375,16 +375,20 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes | |||
* The column definitions provided by the user that contain what the header, data, and footer | |||
* cells should render for each column. | |||
*/ | |||
@ContentChildren(CdkColumnDef) _contentColumnDefs: QueryList<CdkColumnDef>; | |||
@ContentChildren(CdkColumnDef, {descendants: true}) _contentColumnDefs: QueryList<CdkColumnDef>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this makes assumptions that we can't nest tables. AFAIK it's not something we support anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, based on the trick we use the get cell outlets after stamping out row views, we absolutely, 100% do not support nested tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would someone put an ngIf
around a def? My immediate reaction would be that we would want to discourage that
@@ -375,16 +375,20 @@ export class CdkTable<T> implements AfterContentChecked, CollectionViewer, OnDes | |||
* The column definitions provided by the user that contain what the header, data, and footer | |||
* cells should render for each column. | |||
*/ | |||
@ContentChildren(CdkColumnDef) _contentColumnDefs: QueryList<CdkColumnDef>; | |||
@ContentChildren(CdkColumnDef, {descendants: true}) _contentColumnDefs: QueryList<CdkColumnDef>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, based on the trick we use the get cell outlets after stamping out row views, we absolutely, 100% do not support nested tables.
You can see an example in initial report: #17339. |
It seems strange to me, since I I expect people to accomplish things like this either by swapping columns or by putting an |
I'm not sure really. I suppose it's more declarative? It's still something that works with ViewEngine but will break in Ivy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I chatted w/ @andrewseguin and we agreed this is for the best
Three failing targets in Google, I will investigate today |
Two of the targets were projects that had a nested |
The third failure was an instance of the table literally defining each |
Solution for #17339 is to take checkbox outside of *ngfor , it will work as expected. I have implemented in similar way for adding checkbox for MatTable with Ivy Enabled. if checkbox column present in columns Aray it will render. For above approch i have small questions,
I am new to open source contribution, not sure whether to comment on PR or else please Ignore. |
As my solution not working for #17339 , we should merge this PR to solve #17339 |
any predictions to release this fix #17339 ? |
Should be in the first 9.0.0 RC |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes the table not picking descendants that aren't direct descendants. Currently this isn't a huge problem, however with Ivy it'll become an issue that'll prevent consumers from setting an
ngIf
around the defs.Fixes #17339.