<apex:selectList size="1" value="{! LimitSize}">
<apex:selectOptions value="{! paginationSizeOptions}" />
</apex:selectList>
这是我的选择清单。
private String LimitSize = '';
public String getLimitSize() {
return LimitSize;
}
public void setLimitSize(String LimitSize) {
this.LimitSize = LimitSize;
}
public SelectOption[] paginationSizeOptions {
public get;
private set;
}
public SiteController2(){
String[] paginationSize = new String[]{'2','5','10','200','250' };
this.paginationSizeOptions = new SelectOption[]{};
for (String c: paginationSize) {
this.paginationSizeOptions.add(new SelectOption(c,c));
}
LimitSize = paginationSize[0];
}
public checkLimitSize(){
system.debug('Limit Size : '+LimitSize);
}
现在更改选项列表我想为选择的选项列表值分配LimitSize变量,并调用方法checkLimitSize()来检查值。我怎么能这样做?谢谢。
答案 0 :(得分:1)
您可以使用 apex:actionFunction 组件:
<apex:actionFunction action="{!yourControllerMethod}" name="yourFunction"/>
public PageReference yourControllerMethod(){
//body of method
checkLimitSize();
return null;
}
<apex:selectList onchange="yourFunction() ...."
有关详细信息,请参阅the documentation。