You can do something like this
<h:column id="selection_column">
<f:facet name="header">
<h:selectBooleanCheckbox class="checkall"/>
</f:facet>
<h:selectBooleanCheckbox value="#{SessionsController.selectedIds[item.aSessionID]}" />
</h:column>
in your js put this code
$(window).load(function () {
$(document).delegate(".checkall", "click", function(event) {
$(this).closest("table").find(':checkbox').attr('checked', this.checked);
});
});
b.t.w instead of storing in map you can add attribute to your iterated item
like this: instead of value="#{SessionsController.selectedIds[item.aSessionID]}"
something like this value="#{item.selected}"
and later on you can iterate over them in the server side and add to list that will be sent to you r delete method...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…