Saturday, 26 July 2014

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:
====

Set Console Tab title using "Salesforce Console Integration Toolkit"

Hi,

I have the requirement to have a visualforce page in the console view. But when we open a visualforce page from a button or something in the console view then console set the title for console tab as "ExternalPage".
But we want to change that title.

We can change the title of Console tab when we open "visualforce pages or third party applications" by using "Salesforce Console Integration Toolkit"

To use this in the visualforce page we should include the following script file.

<apex:includeScript value="/support/console/20.0/integration.js"/>

Eg:
==
<apex:page>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<apex:includeScript value="/support/console/20.0/integration.js"/>
<script>
 $(document).ready(function() {

      sforce.console.setTabTitle('My Title for Console Tab');
 });
</script>
</apex:page>

when we open this page then title "My Title for Console Tab" for Console Tab where visualforce page opened in console view.

Not only these we can customize more things in Console by using this Tool Kit.

For more information "Salesforce Console Integration Toolkit".