You need to sign in to do that
Don't have an account?
waylonatcim
repeat tags and css fun
I'm trying to put some code in repeat tags and it seems as if the css is getting messed up as a result. For example, if I have the folliwng page and controller:
<apex:page controller="testrepeat" > <apex:form> <apex:pageBlock> <apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel for="field1" value="{!showOne.Name}" /> <apex:inputField value="{!showOne.id}" id="field"/> </apex:pageBlockSectionItem > <apex:repeat value="{!showSome}" var="s" > <apex:pageBlockSectionItem > <apex:outputLabel for="field" value="{!s.name}" /> <apex:inputField value="{!s.id}" id="field"/> </apex:pageBlockSectionItem > </apex:repeat> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
public class testrepeat { public List<Account> showSome{get{ if(showSome == null){ showSome = [select Name, Id from Account limit 3]; } return showSome; }set; } public Account showOne{get{ return showSome[0]; } set; } }
the account from showOne has a particular formatting going on, but the accounts from showSome doesn't seem to have any style at all.
I'm just wondering if this is expected behavior because I would expect that showSome should have the same look as showOne.
figured it out. Needed to throw the pageBlockSection in the repeat tag and it worked out fine. Thanks for being my outlet to talk it out.
All Answers
Ok, after reading the following in the component guide
"Note that if used within a pageBlockSection or panelGrid component, all content generated by a child repeat component is placed in a single pageBlockSection or panelGrid cell."
I tried separating things by pageBlockSections
Which does the formatting correctly, but with each account separated by a pageBlock separator. So now I'm wondering how to get the correct formatting but without the section separators.
figured it out. Needed to throw the pageBlockSection in the repeat tag and it worked out fine. Thanks for being my outlet to talk it out.
thanks for sharing!