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

When using stateStorage for the p-table I always get the following error in the console when the component first loads: #15043

Closed
slagbat opened this issue Mar 13, 2024 · 1 comment · Fixed by #16460
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@slagbat
Copy link

slagbat commented Mar 13, 2024

Describe the bug

When using stateStorage for the p-table I always get the following error in the console when the component first loads:

has-permission.guard.ts:54 ERROR TypeError: Cannot read properties of undefined (reading 'querySelectorAll')
at DomHandler.find (primeng-dom.mjs:70:35)
at Table.saveColumnWidths (primeng-table.mjs:2321:34)
at Table.saveState (primeng-table.mjs:2250:18)
at Table.ngOnChanges (primeng-table.mjs:1028:26)
at Table.rememberChangeHistoryAndInvokeOnChangesHook (core.mjs:3032:14)
at callHookInternal (core.mjs:4024:14)
at callHook (core.mjs:4055:9)
at callHooks (core.mjs:4006:17)
at executeInitAndCheckHooks (core.mjs:3956:9)
at selectIndexInternal (core.mjs:11780:17)

It doesn't seem to cause any real issues with my code as it is only to do wit saving the column widths.

My table is implemented as a custom component as below. The error is shown even when using my table directly in Storybook (as a story) as well as when the component is implemented in our applications:

<p-table #dataTable [dataKey]="'id'" [value]="rows" [columns]="selectedColumns" [styleClass]="styleClass"
  [tableStyle]="tableStyle" [(selection)]="selectedRows" [paginator]="true" [rows]="pageSize"
  [totalRecords]="totalRecords" [resizableColumns]="true" [reorderableColumns]="true"
  [paginatorPosition]="paginatorPosition" [showJumpToPageDropdown]="showJumpToPageDropdown"
  [showCurrentPageReport]="true" [currentPageReportTemplate]="currentPageReportTemplate"
  [loading]="loading" [rowHover]="true" [selectAll]="selectAll" columnResizeMode="fit" [lazy]="true"
  (onLazyLoad)="loadData($event)" (selectAllChange)="toggleAllSelect($event)" (onRowSelect)="selectRow($event)"
  (onRowUnselect)="unselectRow($event)" [lazyLoadOnInit]="false" [scrollable]="scrollable"
  [scrollHeight]="scrollHeight" [showLoader]="true" [stateStorage]="local" stateKey="users-table"
 >

Environment

Linux docker containers

Reproducer

No response

Angular version

16.2.12

PrimeNG version

16.9.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

21.2.0

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No errors are shown in the console.

@slagbat slagbat added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 13, 2024
@hcornelisonJHA
Copy link

We are experiencing the same issue with a table that has the row expanders enabled. Bouncing back and forth to the grid causes this error to be thrown, same version as the original bug report.

@cetincakiroglu cetincakiroglu added this to the 17.18.12 milestone Oct 11, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 11, 2024
@cetincakiroglu cetincakiroglu changed the title Component: Title When using stateStorage for the p-table I always get the following error in the console when the component first loads: Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants