1

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 が呼び出されませんでした。何が起こっているのでしょうか? 前もって感謝します!

4

2 に答える 2

0

手元にあるかどうかはわかりませんが、スイッチタイプをクライアントからサーバーまたは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 に答える