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

Data Table Expandable Rows break when there is a custom column in between the Row Template #245

Closed
ammar91 opened this issue Apr 25, 2016 · 4 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ammar91
Copy link

ammar91 commented Apr 25, 2016

I am trying to implement similar to this one (http://www.primefaces.org/primeng/#/datatablerowexpansion) but one of my column require to use Angular builtin Currency Pipe.

I tried to apply Currency Pipe like below, it throws an error
<p-column field="amount | currency: 'USD': true : '1.2-2'" header="Amount">

So I customized my cell by providing a template like below

<p-column header="Amount"> <template #currentInvoice="rowData"> {{currentInvoice.amount | currency: 'USD': true : '1.2-2'}} </template> </p-column>

However, there is still a problem if I make the column editable. As soon as I click the column to edit, the value wipe's out and when I click outside, it returns back. The value should be there when it get focus. Any thoughts?

And here is the main problem, The row template that I defined right after my all columns, not seems to be working when there is a custom column in between like the above one. So If I have html like below

<p-dataTable [value]="invoices" [responsive]="true" expandableRows="true" [editable]="true"> <p-column header="Amount" [editable]="true"> <template #currentInvoice="rowData"> {{currentInvoice.amount | currency: 'USD': true : '1.2-2'}} </template> </p-column> <template #invoice> <h1>Detail Content</h2> </template>

It throws an error

EXCEPTION: TypeError: Cannot read property 'amount' of null in [ {{currentInvoice.amount | currency: 'USD': true : '1.2-2'}}

Please suggest

@infinity1207
Copy link

I have the same problem.

@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Apr 26, 2016
@cagataycivici cagataycivici added this to the 1.0.0-beta.4 milestone Apr 26, 2016
@cagataycivici cagataycivici self-assigned this Apr 26, 2016
@cagataycivici
Copy link
Member

A real solution is being worked on however quick solution is to move the expansion template before the columns.

http://forum.primefaces.org/viewtopic.php?f=35&t=45226

@ammar91
Copy link
Author

ammar91 commented Apr 26, 2016

Thanks, that works.

@cagataycivici
Copy link
Member

A safer check is added, so that it works regardless of the location.

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

3 participants