数据表中的复选框按钮

i have checkbox column in datatable, i want to have some ajax code which when i click on the checbox button on the header should check all the checkbox in the rendered data rows of the datatable. I am using primefaces, they have something out of box for this but we don't want to implement it. Please let me know if there is a easy solution using ajax.

As of now we have coded as below but we can go something better than that.

<p:dataTable id="userListTable" value="#{Bean.List}"
                    var="user" rowClasses="odd even"


                    <p:column style="width:18px">
                        <f:facet name="header">
                            <p:selectBooleanCheckbox
                                valueChangeListener="#{Controller.toggleCheckBox}"
                                partialSubmit="true" immediate="true" />

                        </f:facet>
                        <p:selectBooleanCheckbox value="#{user.disable}"
                            disabled="#{user.disable}"
                            valueChangeListener="#{circleController.enableDisableOkbutton}"
                            partialSubmit="true" immediate="true" />

                    </p:column>

                    <p:column>

                        <f:facet name="header">
                            <h:outputText value="#{labels['circle.userList.name']}" />
                        </f:facet>
                        <p:panelGrid styleClass="noBorders">
                            <p:row>
                                <p:column rowspan="3" style="width:60px;">
                                    <p:graphicImage
                                        value="#{name}.jpg"
                                        style="width:50px;height:50px" />
                                </p:column>
                                <p:column>

                                    <h:outputText value="  " />
                                    <h:outputText value="#{user.firstName}" />
                                    <h:outputText value="  " />
                                    <h:outputText value="#{user.lastName}" />


                                </p:column>
                            </p:row>
                            <p:row>
                                <h:outputText value="#{user.country}" />
                            </p:row>


                        </p:panelGrid>
                    </p:column>

                </p:dataTable>