Field undefined extended sub-property protection #1182

Merged
merged 1 commit into from Nov 29, 2016

Projects

None yet

2 participants

@saverett
Contributor
saverett commented Nov 1, 2016 edited

Use ng2 elvis-operator style protection for data field sub-properties that could be undefined to help prevent Cannot read property 'X' of undefined exceptions.

For example:
In the following datatable column declaration, primeng datatables would throw a Cannot read property 'c' of undefined exception if b was undefined. It is often the case that extended field sub-properties are present for some collections/rows, and not present for others. This PR solves this problem, while still allowing primeng datatables' built-in features that rely on the fully-qualified field property (such as sorting and filtering) to work correctly:

<p-column field="a.b.c" header="C"></p-column>

@saverett saverett Field undefined extended sub-property protection
Use ng2 elvis-operator style protection for data field sub-properties that could be undefined to help prevent `Cannot read property 'X' of undefined` exceptions.
f1db424
@cagataycivici cagataycivici added this to the 1.0.1 milestone Nov 29, 2016
@cagataycivici cagataycivici self-assigned this Nov 29, 2016
@cagataycivici cagataycivici merged commit 22f2855 into primefaces:master Nov 29, 2016
@cagataycivici
Member

Thank you.

@windwolfreal windwolfreal added a commit to windwolfreal/primeng that referenced this pull request Dec 12, 2016
@windwolfreal windwolfreal check [null] value of the field with nested object
PR #1182 chack the [undefined] value of the field, but not for [null]. this commit fix it.
24130aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment