1

我有一个在 panelBar 中显示的项目列表,每个项目都有一个在控制器上调用操作的命令按钮,问题是操作方法永远不会被调用!帮助?

这是代码:

<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>

和弹出输出面板:

<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 从未被调用,因为我签入了日志,会发生什么?提前致谢!

4

2 回答 2

0

不确定,但您可以尝试将您的 switchtype 从客户端更改为服务器或 ajax:

<apex:panelBar id="eventBarSeller" switchType="server/ajax" items="{!relatedEventsSeller}" var="event" rendered="true">

服务器和 ajax switchTypes 可能比客户端慢一点,但它应该可靠地处理服务器端操作方法。rerender 属性受此影响。来自 VF 开发人员指南:

在此处输入图像描述

于 2012-07-20T05:19:09.980 回答
0

试试这个(对我有用):

页:

<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;
}
于 2012-08-08T13:44:52.623 回答