问题
Recently I switched to mojarra from myfaces and noticed that primefaces datatable checkbox multiple row selection is not working.
I have tried the exact sample program available at http://www.primefaces.org/showcase/ui/datatableRowSelectionRadioCheckbox.jsf
With myfaces both single and multiple selection are working ,but with mojarra multiple selection is not working(selectedCars.length is 0 in setSelectedCars method)
I have tried with mojarra 2.0.3 and mojarra 2.1.0 with primefaces 2.2.1
回答1:
Adding 'f:view contentType="text/html"' solved the problem.
Read this in http://www.primefaces.org/faq.html
回答2:
<p:column sortBy="#{tup.docTypeAndDirection}" >
<f:facet name="header">
<h:outputText value="Document Type"/>
</f:facet>
<h:outputText value="#{tup.docTypeAndDirection}"/>
</p:column>
<p:column sortBy="#{tup.partnerEDIAddress}" >
<f:facet name="header">
<h:outputText value="Partner Trading Address"/>
</f:facet>
<h:outputText value="#{tup.partnerEDIQual}:#{tup.partEDIAddr}"></h:outputText>
</p:column>
</p:dataTable>
来源:https://stackoverflow.com/questions/5569502/primefaces-datatable-selectionmode-multiple-not-working-with-mojarra