Skip to main content

Salesforce.com | How to open a PageBlockSection closed using jQuery

Ever want to default a PageBlockSection to closed?



Here is the secret sauce using jQuery
Insert this snippet into the header
    <script type=”text/javascript”>
        var j$ = jQuery.noConflict();
        j$(document).ready(function(){
            j$(‘.showExtra .hideListButton’).attr(“class”, “showListButton”);
            j$(‘.showExtra .pbSubsection’).css(“display”, “none”);
        });
    </script>
Wrap you pageblocksection code in a div
<div class=”showExtra”>
<apex:pageBlockSection columns=”2″ title=”Extra Fields” >
<apex:repeat value=”{!$ObjectType.Account.FieldSets.Extra_Fields}” var=”f”>
<apex:inputfield  value=”{!Account[f]}” />
</apex:repeat>
</apex:pageBlockSection>
</div>


#kachow …twisty is closed and div is hidden.

Comments

Popular posts from this blog

Override Name in the Salesforce Cloud Console

Service Cloud Console HyperLink Opens new window outside of the console, Opens new tab inside the console. HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcUp('/" & Id & "?isdtp=vw');}"+ " else {window.location.href='/" & Id & "'}", User__r.FirstName + ' ' + User__r.LastName, "_self" ) Checks if the srcUp exists and if it does, you're in the console.