3

today i need your help for an issue I'm facing.

I have the following custom controller

public with sharing myCustomController {

public Map<String, wrapperObj> myMap {
    get {
        // populate map...
    set;
}

// methods and stuffs...

public class wrapperObj {
    public String label;

    public wrapperObj() {}
}

}

And the following VF page associated with the controller

<apex:page showHeader="true" sidebar="true" controller="myCustomController">
<apex:form id="myForm">
    <apex:pageBlock >
            <!-- Map values -->
            <apex:repeat value="{!myMap}" var="key">                                    
                // this works fine
                <apex:outputText value="{!key}" />
                // this works too
                <apex:outputText value="{!myMap[key]}" />
                // this not !!
                <apex:outputText value="{!myMap[key].label}" />

            </apex:repeat>
    </apex:pageBlock>
</apex:form>

Basically the problem is that I'm not able to get field values from the wrapper class defined inside the controller...

Anyone can help with us?

Thank you very much!!

0
2

You need a getter/setter for your label property. Eg:

public class wrapperObj {
    public String label {get;set;}

    public wrapperObj() {}
}
1

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.