简体   繁体   中英

JSF Check all checkboxes

<h:dataTable id="merchantDataTable"
        value="#{merchantManagementBean.merchants}" first="0"
        rows="#{merchantManagementBean.rowsPerPage}" var="merchant"
        styleClass="dataTable"
        columnClasses="users-colMerchant, users-colMerchantDescr,  nostyle"
        rowClasses="oddRow, evenRow">
        <h:column>
            <f:facet name="header">
                <h:panelGrid columns="1">
                    <h:selectBooleanCheckbox />
                </h:panelGrid>
            </f:facet>
            <h:selectBooleanCheckbox value="#{merchant.selected}"/>
        </h:column>
</h:datatable>

Yea so I have this code part and I need to make the main checkbox to make them all checked I can use Probably only Javascript based solution since communication with bean is going to server side.

Please have a look at the following posts:

How to create effective "select all" checkbox in JSF

how to create selectAll checkbox in JSF-2

Or you can approach this problem witj jQuery to select all checkboxes:

http://www.sanwebe.com/2014/01/how-to-select-all-deselect-checkboxes-jquery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM