• An_dy
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

Hi,

  When i click on my VF tab then i want to see all my repeat sections collapsable , here is my code but not sure how to make collapse by default, any help is appreciated

 

<apex:page controller="AutomobileDashboard" sidebar="false">

 <h1>Accounts with Related Opportunities</h1>
<apex:form >
<apex:pageBlock id="table"  >
<apex:repeat value="{!accttree}" var="a" id="table">
        <apex:pageblockSection title="{!a.Name}" columns="1" collapsible="true" id="CollapseDefault">
  <table width="100%" cellpadding ="0" cellspacing = "0">                        
 <tr>
  <th>Name</th>
  <th>Status</th>
  <th>Close Date</th>
  <th>Description</th>
  <th>Highlights</th>
  <th>Mitigation</th>
  <th>Region</th>
  <th>Amount</th>
  </tr>   
 <tr>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='30%'></td>
 <td width='20%'></td>
 <td width='20%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 </tr>
           <apex:repeat value="{!a.opps}" var="c">
            <tr>
             <td><table> <apex:outputlink value="/{!c.id}" target="_blank">
             <apex:outputtext value="{!c.Name}"/>
            </apex:outputlink></table></td>
            <td><table><apex:outputText label="" value="{!c.Status__c}" escape="false"/></table></td>
             <td><table><apex:outputText label="" value="{0,date,MM/dd/yyyy}"><apex:param value="{!c.CloseDate}" /></apex:outputText></table></td>
             <td><table><apex:outputText label="" value="{!c.Description}"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Highlights__c}" style="white-space:pre-wrap;"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Mitigation__c}" style="white-space:pre-wrap;"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Region__c}"/></table></td>
             <td><table><apex:outputText label="" value="{0,number, ###,###,###,###}">
                         <apex:param value="{!c.Amount}"/>
                        </apex:outputText></table></td>
            </tr>
           </apex:repeat>
 </table>
 </apex:pageblockSection>
    </apex:repeat>
   </apex:pageBlock>
           </apex:form>
</apex:page>

  • July 17, 2013
  • Like
  • 0

Hi,

  Iam trying to get atleast 75% coverage for my VF page but not sure what's wrong it's only giving me 46%, any help would be appreciated.

 

VF:

<apex:page controller="AutomobileDashboard" sidebar="false">

 <h1>Accounts with Related Opporunities</h1>
<apex:form >
<apex:pageBlock id="table"  >
<apex:repeat value="{!accttree}" var="a" id="table">
        <apex:pageblockSection title="{!a.Name}" columns="1">
  <table width="100%" cellpadding ="0" cellspacing = "0">                        
 <tr>
  <th>Name</th>
  <th>Close Date</th>
  <th>Description</th>
  <th>Region</th>
  <th>Status</th>
  <th>Amount</th>
  </tr>   
 <tr>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='50%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 </tr>
           <apex:repeat value="{!a.opps}" var="c">
            <tr>
             <td><table> <apex:outputlink value="/{!c.id}" target="_blank">
             <apex:outputtext value="{!c.Name}"/>
            </apex:outputlink></table></td>
             <td><table><apex:outputText label="" value="{0,date,MM/dd/yyyy}"><apex:param value="{!c.CloseDate}" /></apex:outputText></table></td>
             <td><table><apex:outputText label="" value="{!c.Description}"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Region__c}"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Status__c}" escape="false"/></table></td>
             <td><table><apex:outputText label="" value="{0,number, ###,###,###,###}">
                         <apex:param value="{!c.Amount}"/>
                        </apex:outputText></table></td>
            </tr>
           </apex:repeat>
 </table>
 </apex:pageblockSection>
    </apex:repeat>
   </apex:pageBlock>
           </apex:form>
</apex:page>

 

 

Apex Class:

 

public class AutomobileDashboard{

    public List<cAccts> getAccttree() {
        Set<ID> conID = new Set<ID>{};
        for(Opportunity c:[select Id,Name, AccountId, Status__c, Dashboard__c, Description, Region__c, Amount, CloseDate FROM Opportunity where Dashboard__c = true and accountid<>null limit 100]){
            conID.add(c.accountid);
        }
        for(Account a:[select id,Name,(select id,name from opportunities) from Account where id in :conID]){
            retAccts.add(new cAccts(a));
        }  
        return retAccts;
    }

    public List<cAccts> retAccts = new List<cAccts>{};
    public class cAccts{
       public String Name {get; set;}
       public List<Opportunity> opps {get; set;}
       cAccts(Account a){
           Name=a.Name;
           opps=[select Id,Name, AccountId, Status__c, Dashboard__c, Description, Region__c, Amount, CloseDate from Opportunity where accountid =:a.id];
       }
    }

}

 

Test Class:

 

@istest
public class dashboardtestclass{

    static testMethod void theTests(){
    
      Account acc = new Account(name='test account',Vertical_Market__c ='Automotive');
      insert acc;
      
      Opportunity opp = new Opportunity(name='test opp',AccountId = acc.id,CurrencyIsoCode='USD',CloseDate = system.Today(),StageName='Discovery/Prospecting');
      
      insert opp;
      
     AutomobileDashboard sno = new AutomobileDashboard();
      sno.getAccttree();
       
        
     }
    
  }

  • June 24, 2013
  • Like
  • 0

Hi,

  When i click on my VF tab then i want to see all my repeat sections collapsable , here is my code but not sure how to make collapse by default, any help is appreciated

 

<apex:page controller="AutomobileDashboard" sidebar="false">

 <h1>Accounts with Related Opportunities</h1>
<apex:form >
<apex:pageBlock id="table"  >
<apex:repeat value="{!accttree}" var="a" id="table">
        <apex:pageblockSection title="{!a.Name}" columns="1" collapsible="true" id="CollapseDefault">
  <table width="100%" cellpadding ="0" cellspacing = "0">                        
 <tr>
  <th>Name</th>
  <th>Status</th>
  <th>Close Date</th>
  <th>Description</th>
  <th>Highlights</th>
  <th>Mitigation</th>
  <th>Region</th>
  <th>Amount</th>
  </tr>   
 <tr>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='30%'></td>
 <td width='20%'></td>
 <td width='20%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 </tr>
           <apex:repeat value="{!a.opps}" var="c">
            <tr>
             <td><table> <apex:outputlink value="/{!c.id}" target="_blank">
             <apex:outputtext value="{!c.Name}"/>
            </apex:outputlink></table></td>
            <td><table><apex:outputText label="" value="{!c.Status__c}" escape="false"/></table></td>
             <td><table><apex:outputText label="" value="{0,date,MM/dd/yyyy}"><apex:param value="{!c.CloseDate}" /></apex:outputText></table></td>
             <td><table><apex:outputText label="" value="{!c.Description}"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Highlights__c}" style="white-space:pre-wrap;"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Mitigation__c}" style="white-space:pre-wrap;"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Region__c}"/></table></td>
             <td><table><apex:outputText label="" value="{0,number, ###,###,###,###}">
                         <apex:param value="{!c.Amount}"/>
                        </apex:outputText></table></td>
            </tr>
           </apex:repeat>
 </table>
 </apex:pageblockSection>
    </apex:repeat>
   </apex:pageBlock>
           </apex:form>
</apex:page>

  • July 17, 2013
  • Like
  • 0

Hi,

  Iam trying to get atleast 75% coverage for my VF page but not sure what's wrong it's only giving me 46%, any help would be appreciated.

 

VF:

<apex:page controller="AutomobileDashboard" sidebar="false">

 <h1>Accounts with Related Opporunities</h1>
<apex:form >
<apex:pageBlock id="table"  >
<apex:repeat value="{!accttree}" var="a" id="table">
        <apex:pageblockSection title="{!a.Name}" columns="1">
  <table width="100%" cellpadding ="0" cellspacing = "0">                        
 <tr>
  <th>Name</th>
  <th>Close Date</th>
  <th>Description</th>
  <th>Region</th>
  <th>Status</th>
  <th>Amount</th>
  </tr>   
 <tr>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='50%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 <td width='5%'></td>
 </tr>
           <apex:repeat value="{!a.opps}" var="c">
            <tr>
             <td><table> <apex:outputlink value="/{!c.id}" target="_blank">
             <apex:outputtext value="{!c.Name}"/>
            </apex:outputlink></table></td>
             <td><table><apex:outputText label="" value="{0,date,MM/dd/yyyy}"><apex:param value="{!c.CloseDate}" /></apex:outputText></table></td>
             <td><table><apex:outputText label="" value="{!c.Description}"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Region__c}"/></table></td>
             <td><table><apex:outputText label="" value="{!c.Status__c}" escape="false"/></table></td>
             <td><table><apex:outputText label="" value="{0,number, ###,###,###,###}">
                         <apex:param value="{!c.Amount}"/>
                        </apex:outputText></table></td>
            </tr>
           </apex:repeat>
 </table>
 </apex:pageblockSection>
    </apex:repeat>
   </apex:pageBlock>
           </apex:form>
</apex:page>

 

 

Apex Class:

 

public class AutomobileDashboard{

    public List<cAccts> getAccttree() {
        Set<ID> conID = new Set<ID>{};
        for(Opportunity c:[select Id,Name, AccountId, Status__c, Dashboard__c, Description, Region__c, Amount, CloseDate FROM Opportunity where Dashboard__c = true and accountid<>null limit 100]){
            conID.add(c.accountid);
        }
        for(Account a:[select id,Name,(select id,name from opportunities) from Account where id in :conID]){
            retAccts.add(new cAccts(a));
        }  
        return retAccts;
    }

    public List<cAccts> retAccts = new List<cAccts>{};
    public class cAccts{
       public String Name {get; set;}
       public List<Opportunity> opps {get; set;}
       cAccts(Account a){
           Name=a.Name;
           opps=[select Id,Name, AccountId, Status__c, Dashboard__c, Description, Region__c, Amount, CloseDate from Opportunity where accountid =:a.id];
       }
    }

}

 

Test Class:

 

@istest
public class dashboardtestclass{

    static testMethod void theTests(){
    
      Account acc = new Account(name='test account',Vertical_Market__c ='Automotive');
      insert acc;
      
      Opportunity opp = new Opportunity(name='test opp',AccountId = acc.id,CurrencyIsoCode='USD',CloseDate = system.Today(),StageName='Discovery/Prospecting');
      
      insert opp;
      
     AutomobileDashboard sno = new AutomobileDashboard();
      sno.getAccttree();
       
        
     }
    
  }

  • June 24, 2013
  • Like
  • 0

Hi

 

I want a pageblock section to be collapsed by default at the time of page loading. I tried using solutions posted on our discussion board but none of them are working correctly. Please post the correct approach.

 

thanks