I have a wrapper class within my component controller
public class WrapperClass{
public Decimal base { get; set; }
public Decimal goal { get; set; }
public String suffix { get; set; }
...
public Goal(String suffix, Decimal base, Decimal goal){
this.suffix = suffix;
this.base = base;
this.goal = goal;
}
}
This is then constructed into a map that is indexed by month like so:
public Map<String,WrapperClass> wrapperItems{ get; set; }
I also have a wrapper class for Month
and have a list of those that I <apex:repeat>
through in my component like so:
Component:
<apex:repeat value="{!months}" var="month">
<apex:inputText id="myId" value="{!wrapperItems[month.Name].goal}">
<apex:actionSupport event="onchange" action="{!modifyItem}" rerender="currentSection" status="mypoller">
<!-- I've attempted passing parameters to get what I need but with no luck -->
<apex:param name="month" value="{!month.name}"></apex:param>
<apex:param name="suffix" value="{!wrapperItems[month.Name].suffix}"></apex:param>
</apex:actionSupport>
</apex:inputText>
</apex:repeat>
NOTE: I'm using actionSupport to do an onChange
event, not sure if that would have any effect here, and not sure of another option to get desired interaction
Controller:
public PageReference modifyItem(){
String month = String.valueOf(ApexPages.currentPage().getParameters().get('month'));
System.debug('::ITEM:: '+wrapperItems.get(month));
}
I've got getters/setters setup in my wrapper class and for the wrapperItems
map, which I found was a common issue for other users. Not sure what else I'm missing here so really appreciate any help that can be offered.
WrapperClass
as a property onMonth
? Just don't want to inject that dependency?value="{!month.wrapperInstance.goal}"
). You could also make a separateComboWrapper
that has both so it's more natural.apex:param assignTo="{!wrapper.variable}"
for each row ?apex:actionsupport
, you should use on-change event and call action function while passing necessary parameters. Then you may get binded values also.