I'm using a function to check if all the checkboxes are checked to perform the load of an already filled register.
So I wanted to know how to call the function.
function selectAllCheckbox() {
var booleanArray = new Array();
var allCheckBox = $('input[id*="ufs"]');
$(allCheckBox).each(function() {
if ($(this).prop('checked') == true) {
booleanArray.push($(this).prop('checked'));
}
});
if (booleanArray.length == 27) {
allCheckBox.last().prop('checked', true);
}
}
In this I check if all the checkboxes are filled, if so, mark the checkbox all.
<p:selectManyCheckbox id="ufs" value="#{lojaBean.pojo.ufsInss}" layout="grid" columns="4" styleClass="columnLeft">
<f:selectItems value="#{lojaBean.helper.estados}"/>
<f:selectItem itemLabel="Todos" itemValue=""/>
<p:ajax event="change" onstart="selectAll(event)" update="ufs"/>
</p:selectManyCheckbox>
I use another method selectAll(event)
to when selecting the button, select all. I would like when loading a page, it checks if all checkboxes have been filled, but I do not know how to call ...