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

TypeError: Cannot read property 'length' of null for DataTable with headerCheckboxToggleAllPages true #2796

Closed
saverett opened this issue May 16, 2017 · 0 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@saverett
Copy link
Contributor

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior
Before the DataTable's value property is initialized, the get allSelected() function is throwing a TypeError when the headerCheckboxToggleAllPages property is set to true.

Expected behavior
The get allSelected() function should also check to ensure the DataTable's value property is also defined (not null) before comparing its length to the selection length.

Minimal reproduction of the problem with instructions
Create a DataTable with paging, multiple select, and the headerCheckboxToggleAllPages property is set to true. Make sure the DataTable's value doesn't resolve right away.

What is the motivation / use case for changing the behavior?
The new headerCheckboxToggleAllPages DataTable option is missing a null check.

Please tell us about your environment:
Windows

  • Angular version: 4.x

  • PrimeNG version: 4.0.1

  • Browser: All

  • Language: All

saverett added a commit to saverett/primeng that referenced this issue May 16, 2017
@cagataycivici cagataycivici self-assigned this May 26, 2017
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label May 26, 2017
@cagataycivici cagataycivici added this to the 4.0.2 milestone May 26, 2017
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

No branches or pull requests

2 participants