Last active
August 29, 2015 14:08
-
-
Save Sunil02kumar/7aee5621faf5ea42d8a7 to your computer and use it in GitHub Desktop.
Column Header is not getting replaced in Apex:repeat tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class competitorEntryController { | |
private String Oppid; | |
public oppwrapper parentrec{get;set;} | |
public List<oppwrapper> opplist{get;set;} | |
public competitorEntryController(Apexpages.standardcontroller controller){ | |
Oppid=(string)controller.getrecord().get('Id'); | |
parentrec=new oppwrapper(); | |
for(Opportunity opp:[select id,name,(select id,name,name__c,Stage__c,NextStep__c from Competitors__r order by name), | |
Stagename,nextstep from Opportunity where id=:Oppid]){ | |
parentrec.opp=opp; | |
if(opp.Competitors__r.size()>0){ | |
List<CompetitorWrapper> temp=new List<CompetitorWrapper> (); | |
for(Competitor__c cm:opp.Competitors__r){ | |
competitorWrapper cw=new competitorWrapper(); | |
cw.comp=cm; | |
temp.add(cw); | |
} | |
parentrec.complist=temp; | |
} | |
} | |
opplist=new List<oppwrapper> (); | |
system.debug('*******parentrec.complist:'+parentrec.complist); | |
opplist.add(parentrec); | |
} | |
public PageReference Submit(){ | |
//update operation on opportunity and competitor records | |
Pagereference pag=new PageReference('/'+Oppid); | |
return pag; | |
} | |
public class oppwrapper{ | |
public opportunity opp{get;set;} | |
public List<CompetitorWrapper> complist{get;set;} | |
public oppwrapper(){ | |
complist=new List<CompetitorWrapper>(); | |
} | |
} | |
public class competitorWrapper{ | |
public Competitor__c comp{get;set;} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Opportunity" extensions="competitorEntryController"> | |
<apex:form > | |
<apex:pageblock title="Competitor section"> | |
<apex:pageblockButtons > | |
<apex:commandButton value="Save" Action="{!Submit}"/> | |
</apex:pageblockButtons> | |
<apex:pageBlocksection title="Using pageblocktable on VF page. problem with Column header value display in repeat tag" columns="1"> | |
<apex:pageblocktable value="{!opplist}" var="op"> | |
<apex:column headervalue="{!Opportunity.name}"> | |
<apex:pageblocksection columns="1"> | |
<apex:inputField value="{!op.opp.stagename}"/> | |
<apex:inputField value="{!op.opp.nextstep}"/> | |
</apex:pageblocksection> | |
</apex:column> | |
<apex:repeat value="{!op.complist}" var="cp"> | |
<apex:column headervalue="{!cp.comp.name}"> | |
<apex:pageblocksection columns="1"> | |
<apex:inputField value="{!cp.comp.Stage__c}"/> | |
<apex:inputField value="{!cp.comp.NextStep__c}"/> | |
</apex:pageblocksection> | |
</apex:column> | |
</apex:repeat> | |
</apex:pageblocktable> | |
</apex:pageBlocksection> | |
</apex:pageblock> | |
</apex:form> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment