0

I have below code snippet where I have perfectly working select all checkbox. My requirement is to deselect the checkbox after I have successfully updated relevant records in apex class.

Page

<apex:pageblockTable id="XYZ" value="{!wrapList}" var="itr" >
                            <apex:column >
                                <apex:facet name="header">
                                    <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                                </apex:facet>
                                <apex:inputCheckbox value="{!itr.selected}" id="inputId"/>
                            </apex:column>......

Select All function

 function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");                  
            for(var i=0; i<inputCheckBox.length; i++){          
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){                                     
                    inputCheckBox[i].checked = obj.checked;
                }
            }
       }

I need to deselect obj.checked = false only after DML update done and Success pagemessage shows on Page.

Can someone please help me here?

1

You would need to bind it to something:

public Boolean isSelectAllChecked { get; set; }

...

<apex:inputCheckbox value="{!isSelectAllChecked}" onclick="selectAllCheckboxes(this,'inputId')"/>

From there, you can toggle it as you like in Apex code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.