Reputation: 7226
I'm working with a DataTable, and I'm having some trouble displaying a value from an EL
in the footer. I have made a simplified version of my xhtml
that still reproduces the error.
If I do the p:dataTable
like this it all works:
<p:dataTable value="#{myMB.items}" var="item">
<p:column headerText="Value" footerText="Value">
<h:outputText value="#{item.value}">
<f:convertNumber pattern="###,##0.00"/>
</h:outputText>
</p:column>
</p:dataTable>
I get this as a result:
The footer shows just fine. And then I try it with EL
, changing the column definition like this:
<p:column headerText="Value" footerText="#{3 + 11}">
<h:outputText value="#{item.value}">
<f:convertNumber pattern="###,##0.00"/>
</h:outputText>
</p:column>
And it evaluates my expression, I get this as a result:
It shows the correct value 14
in the footer. But when I try to use a value from my model, it doesn't show. See the example:
Code:
<p:column headerText="Value" footerText="#{item.value}">
<h:outputText value="#{item.value}">
<f:convertNumber pattern="###,##0.00"/>
</h:outputText>
</p:column>
Output:
And I have tried to do the footer in different ways. Not a single attempt worked.
Is there a correct way to do this? In the showcase it seems to work just fine.
I am using PrimeFaces 3.3.1
Upvotes: 0
Views: 612
Reputation: 7226
The problem was lack of attention.
I failed to realize that I have multiple column values for a single footer. And since JSF can't decide on a single value, it shows nothing.
Shortly after I posted this the answer came to me. I tried to define a single value on my ManagedBean
to use as footer, and it work just fine.
Again, there's nothing wrong with JSF and/or PrimeFaces, it was just lack of logical thinking from my part.
It works on the showcase, because it shows subtables that actually do have a footer for each value.
Upvotes: 1