1

Error: Unknown property 'VisualforceArrayList.lstWrp' I am trying to understand how does the pageblock table loop the repeat. I have done a similar page to account , contact object it worked fine but not with wrappers.

<apex:page controller="vendorDashboard" lightningStylesheets="true">
    <body>
        <apex:slds />
    </body>
    <apex:pageBlock id="mainBlock">
        <apex:repeat value="{!lstWrap}" var="acc">
            <apex:pageBlockSection title="{!acc.SectionName}" columns="1">
                <apex:pageBlockTable value="{!lstWrap.lstWrp}" var="a">
                    <apex:column value="{!a.FieldName}"/>
                    <apex:column value="{!a.FieldValue}"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>

Controller:

public class vendorDashboard{
    public list<WrapSection> lstWrap{get;set;}    
    public vendorDashboard(){
        lstWrap = new list<WrapSection>();         
        list<WrapFields> lw = new list<WrapFields>();
        list<WrapFields> lw2 = new list<WrapFields>();        
        WrapFields WF = new WrapFields();
        WF.FieldName = 'field1';
        WF.FieldValue = 'value1';
        lw.add(WF);
        WrapFields WF1 = new WrapFields();
        WF1.FieldName = 'field2';
        WF1.FieldValue = 'value2';
        lw.add(WF1);
        WrapFields WF3 = new WrapFields();
        WF3.FieldName = 'field3';
        WF3.FieldValue = 'value3';
        lw.add(WF3);
        WrapFields WF4 = new WrapFields();
        WF4.FieldName = 'field4';
        WF4.FieldValue = 'value4';
        lw2.add(WF4);        
        WrapSection WS = new WrapSection(lw,'Section1');
        WrapSection WS2 = new WrapSection(lw2,'Section2');
        lstWrap.add(WS);
        lstWrap.add(WS2);
    }
    public class WrapFields{
        public string FieldName{get;set;}
        public string FieldValue{get;set;}    
    }
    public class WrapSection{
        public list<WrapFields> lstWrp{get;set;}
        public string SectionName{get;set;}
        public WrapSection(list<WrapFields> lstWrp1,string SectionName1){
            this.lstWrp = lstWrp1;
            this.SectionName = SectionName1;
        }
    }
}

I'm trying to build page in this format enter image description here

2

You needed to access the "acc" variable, which contains the list in each section wrapper:

            <apex:pageBlockTable value="{!acc.lstWrp}" var="a">
2
  • 1
    @SFDCJoe No problem! Sometimes we all just need a "second pair of eyes" when we've been staring too long.
    – sfdcfox
    Mar 22 '18 at 14:51
  • @SFDCJoe If fox's answer solved your issue, please mark it so by click the checkmark icon. Thanks! Mar 22 '18 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.