Skip to content
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

Table: ERROR TypeError: Cannot set property 'left' of undefined #12460

Closed
felikf opened this issue Jul 31, 2018 · 2 comments · Fixed by #12462
Closed

Table: ERROR TypeError: Cannot set property 'left' of undefined #12460

felikf opened this issue Jul 31, 2018 · 2 comments · Fixed by #12462
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@felikf
Copy link

felikf commented Jul 31, 2018

Bug, enhancement request, or proposal:

  • regression

After upgrading from 5.2.4 to 6.4.1 i see the following error in console:

preview-fe7237b13d780dbf847da.js:1 ERROR TypeError: Cannot set property 'left' of undefined
    at StickyStyler._removeStickyStyle (sticky-styler.ts:159)
    at StickyStyler.clearStickyPositioning (sticky-styler.ts:48)
    at MatTable.CdkTable.updateStickyColumnStyles (table.ts:596)
    at MatTable.CdkTable.renderRows (table.ts:472)
    at SafeSubscriber.eval [as _next] (table.ts:794)
    at SafeSubscriber.__tryOrUnsub (Subscriber.ts:270)
    at SafeSubscriber.next (Subscriber.ts:212)
    at Subscriber._next (Subscriber.ts:142)
    at Subscriber.next (Subscriber.ts:102)
    at TakeUntilSubscriber.Subscriber._next (Subscriber.ts:142)

It is related to table component, code fragment that causes the error:

<ng-container *matRowDef="let row; columns: displayedColumns;">
    <mat-row ></mat-row>
</ng-container>

This works without error in console:

    <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>

CodePen and steps to reproduce the issue:

https://stackblitz.com/edit/angular-5vkqs1?file=app/table-pagination-example.html

Detailed Reproduction Steps:

  1. open https://stackblitz.com/edit/angular-5vkqs1
  2. look in the console
  3. observe the error

What is the expected behavior?

no error in console for mat-row using ng-container:

<ng-container *matRowDef="let row; columns: displayedColumns;">
    <mat-row ></mat-row>
</ng-container>

What is the current behavior?

What is the use-case or motivation for changing an existing behavior?

My use case is that I need to render special kind of summary rows like that:

<ng-container *matRowDef="let row; columns: displayedColumns;">
    <div *ngIf="summaryRow">
         This is summary row which is related to group of other rows and displays number summaries
    </div>

    <mat-row [style.display]="summaryRow 'none' : 'flex'">     
    </mat-row>
</ng-container>

image

Which versions of Angular, Material, OS, and browsers are affected?

  • Angular: 6.0.3
  • Angular Material: 6.4.1
  • OS:
  • Browsers: Chrome Version 67.0.3396.87 (Official Build) (64-bit)

Is there anything else we should know? Stack Traces, Screenshots, etc.

image

@crisbeto crisbeto self-assigned this Jul 31, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 31, 2018
Fixes the table throwing an error if the row definitions are on an `ng-container`.

Fixes angular#12460.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Jul 31, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 1, 2018
Fixes the table throwing an error if the row definitions are on an `ng-container`.

Fixes angular#12460.
@felikf
Copy link
Author

felikf commented Aug 1, 2018

@crisbeto thanks for fixing this

current workaround - replace ng-container with div:

<div *matRowDef="let row; columns: displayedColumns;">
    <div *ngIf="summaryRow">
         This is summary row which is related to group of other rows and displays number summaries
    </div>

    <mat-row [style.display]="summaryRow 'none' : 'flex'">     
    </mat-row>
</div>

jelbourn pushed a commit that referenced this issue Aug 3, 2018
Fixes the table throwing an error if the row definitions are on an `ng-container`.

Fixes #12460.
jelbourn pushed a commit that referenced this issue Aug 7, 2018
Fixes the table throwing an error if the row definitions are on an `ng-container`.

Fixes #12460.
jelbourn pushed a commit that referenced this issue Aug 7, 2018
Fixes the table throwing an error if the row definitions are on an `ng-container`.

Fixes #12460.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants