我有一个在panelBar中显示的项目列表,每个项目都有一个调用控制器上的操作的comandButton,问题是该操作方法从未被调用!帮助?
代码如下:
<apex:panelBar id="eventBarSeller" switchType="client" items="{!relatedEventsSeller}" var="event" rendered="true">
<apex:panelbarItem label="{!event.SUBJECT__c}">
<apex:outputText escape="false" value="{!event.BODY__c}" />
<br/>
<br/>
<apex:commandButton value="View details" action="{!showPopup}" rerender="popup" immediate="true" rendered="true"/>
</apex:panelBarItem>
</apex:panelbar>和弹出式outputPanel:
<apex:outputPanel id="popup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopup}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopup}">
This is where I would put whatever information I needed to show to my end user.<br/><br/><br/>
<apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="popup"/>
</apex:outputPanel>
</apex:outputPanel>在控制器中,我有以下内容:
public boolean displayPopup {get; set;}
public void closePopup() {
System.Debug(LoggingLevel.INFO, 'Close Popup...');
displayPopup = false;
}
public void showPopup() {
System.Debug(LoggingLevel.INFO, 'Show Popup...');
displayPopup = true;
}因为我检查了日志,所以showPopup get函数从未被调用过,这会发生什么?提前感谢!
发布于 2012-07-20 13:19:10
暂时不确定,但您可以尝试将切换类型从客户端更改为服务器或ajax:
<apex:panelBar id="eventBarSeller" switchType="server/ajax" items="{!relatedEventsSeller}" var="event" rendered="true">服务器和ajax switchTypes可能比客户端慢一点,但它应该可以可靠地处理服务器端的操作方法。rerender属性受此影响。来自VF开发人员指南:

发布于 2012-08-08 21:44:53
试试这个(对我有效):
页面:
<apex:form>
<apex:panelBar>
<apex:panelbarItem>
<apex:commandButton value="View details" action="{!showPopup}" reRender="myPopup"/>
</apex:panelBarItem>
</apex:panelbar>
<apex:outputPanel id="myPopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopup}">
Your Information Here
</apex:outputPanel>
</apex:outputPanel>
</apex:form>控制器:
public Boolean displayPopup { get; set; }
public PageReference showPopup() {
System.Debug(LoggingLevel.INFO, 'Show Popup...');
displayPopup = true;
return null;
}https://stackoverflow.com/questions/11571399
复制相似问题