Select All CheckBox using Jquery in visualforce page | Techila
2602
single,single-post,postid-2602,single-format-standard,ajax_updown_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,qode-content-sidebar-responsive,qode-theme-ver-9.4.2,bridge,wpb-js-composer js-comp-ver-4.12,vc_responsive
 

Select All CheckBox using Jquery in visualforce page

JQUERY IN VISUALFORCE PAGE

Select All CheckBox using Jquery in visualforce page

We have many requirements to have “Select All ” records in visualforce page. We can achieve this through the javascript and Jquery.

 

If we choose jquery we can reduce the lines of code in javascript and we can easily get the functionality.

 

<apex:page controller=”MassUpdateAllcls” sidebar=”false”>

  <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”></script>

    <script type=”text/javascript”>

        $(document).ready(function() {

            $(“#parentCheck”).click(function() {

                $(“.childCheck”).prop(‘checked’, this.checked);

            });

            $(“.childCheck”).click(function(){

                if ($(‘input.childCheck[type=checkbox]:not(:checked)’).length){

                    $(“#parentCheck”).removeAttr(‘checked’);    

                }else{

                    $(“#parentCheck”).prop(‘checked’,true);

                }

            });

        })

    </script>

<apex:form >

<apex:pageBlock >

<apex:pageBlockTable value=”{!accountWrapperList}” var=”actWrap”>

<apex:column >

<apex:facet name=”header”>

<input type=”checkbox” id=”parentCheck”/>

</apex:facet>

<apex:inputCheckbox value=”{!actWrap.isSelect}” styleClass=”childCheck”/>

</apex:column>

<apex:column headerValue=”Account Name” value=”{!actWrap.actobj.Name}”/>

</apex:pageBlockTable>

</apex:pageBlock>

</apex:form>

</apex:page>

Output:

select all jquery

“Know more about Salesforce Consulting at Techila”

Author: techila

No Comments

Post A Comment