I've done this via JavaScript and it visually worked. However, when submitting the form, it seems the "checked" value isn't submitted. If I click on the checkbox twice (to uncheck and check it again), it works.
Code: Select all
<p:dataTable var="invoiceGroup"
selection="#{chargeBean.selectedInvoiceGroupBeans}"
value="#{chargeBean.invoiceGroupList}"
rowKey="#{invoiceGroup.id}">
<p:column selectionMode="multiple" />
...
</p:dataTable>
Code: Select all
function selectTableElements() {
var checkBoxes = $('#invoiceGroupTable td.ui-selection-column input[type="checkbox"]');
var paginatorPages = $('#invoiceGroupTable .ui-paginator .ui-paginator-pages .ui-paginator-page');
if (checkBoxes.length === 1 && paginatorPages.length === 1) {
setTimeout(function () {
$('#invoiceGroupTable th input[type="checkbox"]').click();
}, 10);
}
}
Primefaces 3.0M2 - JSF 2.0 - JBOSS 4.2.3.GA