Created
June 30, 2017 09:11
-
-
Save hatemalimam/6a2d04d49afb36d3eb5a2bfd856c8d2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p:selectBooleanCheckbox itemLabel="Check All" | |
widgetVar="checkAllWV" | |
onchange="selectAllCheckBoxes(PF('checkAllWV'),PF('manyCheckWV'))"> | |
</p:selectBooleanCheckbox> | |
<p:selectManyCheckbox widgetVar="manyCheckWV"> | |
<f:selectItems value="#{mainBean.list}"/> | |
</p:selectManyCheckbox> | |
<script> | |
function selectAllCheckBoxes(selectAllCheckbox, manyCheckBoxes) { | |
manyCheckBoxes.inputs.each(function() { | |
if(selectAllCheckbox.isChecked()) { | |
$(this).prop('checked', false) | |
selectAllCheckbox.jq.find('.ui-chkbox-label').text('Uncheck all') | |
} else { | |
$(this).prop('checked', true) | |
selectAllCheckbox.jq.find('.ui-chkbox-label').text('Check all') | |
} | |
$(this).trigger('click'); | |
}) | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment