+ Start a Discussion
prasanth kumarprasanth kumar 

apex:pageblocksection onclick=expand please help.

My requirement is display account and coressponding contacts in visualforce page.  so i used pageblocksection . I used javascript code for default non-expand of data.  

If any one clicks on "leftside button"  then data expanding and  showing.  Thats well and working.   i want if a person clicks on text of pageblocksection title or pageblocksection  empty area then it should expand.

please help me what to do for it,  i started to write javascript code, but confused what to do write in it.   
<apex:page controller="actocons" tabStyle="Account">


function showdata()


    <apex:pageBlock >

    <apex:repeat value="{!acct}" var="a">

       <apex:pageBlockSection id="section1" title="{!a.name}" onclick="showdata()" >
<script>twistSection(document.getElementById("{!$Component.section1}").childNodes[0].childNodes[0]); </script>
<apex:outputField value="{!a.Name}"/>

         <apex:pageBlockTable value="{!a.Contacts}" var="c" id="j1">
                      <apex:column value="{!c.id}" />
            <apex:column value="{!c.lastname}"/>
            <apex:column value="{!c.email}" />



apex code:-

public class actocons
public list<account> acct{set;get;}
public actocons()
acct=[select id,name,(select id,lastname,email from contacts)from account limit 10 offset 4];

prasanth kumarprasanth kumar
this is the screen shot. 

User-added image
prasanth kumarprasanth kumar
please some one help me. thanks in advance
Raghu RamanujamRaghu Ramanujam

Hi Prasanth,

Did you manage to do this ??