How to get the selected values? And depending on how many values I have chosen, change the label on the element? I tried to write a script, but nothing happened, because update label does not occur. Those. when all values are selected, the word "All" is displayed. But when I remove the checkbox, it does not disappear. And if you add an update, the menu with the checkbox will be minimized.
<p:selectCheckboxMenu value="#{managedBean.filterDepartmentIds}" id="emdepartmentList" widgetVar="emdepartmentList" label="..." required="#{empty managedBean.filterDepartmentIds}" rendered="#{managedBean.isCreateMode}" styleClass="-fill" multiple = "true"> <p:ajax update="toolTipFade"/> <p:ajax process="@this" update="test1" event="toggleSelect" oncomplete="if (PF('emdepartmentList').inputs.filter(':checked').length === #{managedBean.departmentList.size()}){ PF('emdepartmentList').label.text('#{msg['all']}'); } else { PF('emdepartmentList').label.text('...'); }"/> I use Primefaces 5.3. I cannot upgrade to a newer version due to certain circumstances.