I have a data table like:
<h:dataTable id="box-score-away" value="#{individualAwayBoxScoreQuery.resultList}" var="_bssl">
<f:facet name="header">
<h:outputText value="Away Team" />
</f:facet>
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputText value="#{_bssl.name}" />
<f:facet name="footer">
<h:outputText value="Σ" styleClass="bold" />
</f:facet>
</h:column>
...
</h:dataTable>
When the result list has no elements, the table's tbody becomes empty. Firefox has problems with that and page rendering is really messed up.
How do I add a line to tbody when the result list is empty? (Note, it's not about the condition but rather the components to use and where to put them.)
The row is supposed to be a td with a colspan of 10. I tried a few things without success. Is f:verbatim the way to go?
#{individualAwayBoxScoreQuery.resultList}
You can handle this in your model. Conditionally return a List containing a single empty bean (I guess a Map would do too). There are several ways to do this: in the back bean; an EL functions; etc.
If memory servers, MyFaces does this automatically to generate valid XHTML.
I had similar problem and I ended up using dojo to add a <tr> to the table body.
For the example above it might look something like below:
dojo.addOnLoad(function(){
if(dojo.isMozilla) {
var bodyElem = dojo.query(".yourTablesStyleClass tbody")[0];
dojo.create("tr", null, bodyElem, "last");
} });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With