我正在尝试根据选择列表的值刷新页面块部分。这是VF:
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!reasonCode}">
<apex:selectOptions value="{!reasonCodes}"/>
<apex:actionSupport event="onchange" reRender="a"/>
<apex:actionSupport event="oncomplete" action="{!isAcceptedReasonCode}" reRender="orders"/>
</apex:selectList>
</apex:pageblockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection id="orders" rendered="{!isAcceptedRC==true}" >
<apex:outputLabel value="Order Number" for="odNum"/>
<apex:inputText id="odNum" value="{!OrderNumber}"/>
</apex:pageBlockSection>
我尝试了很多不同的事件,但似乎都没有。这是isAcceptedReasonCode函数:
public PageReference isAcceptedReasonCode (){
if(reasonCode == 'Accepted Offer') {
isAcceptedRC = true;
}else {
isAcceptedRC = false;
}
return null;
}
这看起来非常简单,但似乎并不奏效...当然我将选择列表更改为=&#39;接受的优惠&#39;
答案 0 :(得分:0)
在选择选项更改时,在顶点上方添加apex:outputPanel:pageBlockSection和reRender outputpanel。
示例代码:
<apex:pageblockSectionItem >
<apex:selectList size="1" value="{!reasonCode}">
<apex:selectOption itemLabel="Test" itemValue="Test"></apex:selectOption>
<apex:selectOption itemLabel="Accepted Offer" itemValue="Accepted Offer"></apex:selectOption>
<apex:actionSupport event="onchange" action="{!isAcceptedReasonCode}" reRender="testPanel"/>
</apex:selectList>
</apex:pageblockSectionItem >
</apex:pageBlockSection>
<apex:outputPanel id="testPanel">
<apex:pageBlockSection id="orders" rendered="{!isAcceptedRC}" >
<apex:outputLabel value="Order Number" for="odNum"/>
<apex:inputText id="odNum" value="{!OrderNumber}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock >