0

a4j:commandButton をクリックした後、モデルからのメッセージを含む rich:notify を表示したいですか?

commandButton をクリックした直後にこの通知をトリガーする方法は?

ここに私が使用するコードがあります:

**データ表** * ****

<rich:dataTable id="currencyDataTable"  value="#{s2MCurrencyModel.getAllS2MCurrency()}"
                var="currency" border="1">

                <rich:column>
                    <f:facet name="header">Task ID</f:facet>
                    <h:outputText value="#{currency.taskId}" />
                </rich:column>
........
                <rich:column>
                    <h:form>

                        <a4j:commandButton value="Delete"
                            render="currencyDeleteInfo"
                            oncomplete="#{rich:component('currencyDelete')}.show()"
                            disabled="#{!currency.status.equals('I')}">
                            <f:setPropertyActionListener
                                target="#{s2MCurrencyModel.selectedCurrency}"
                                value="#{currency}" />
                        </a4j:commandButton>
                    </h:form>
                </rich:column>
            </rich:dataTable>

<!-- =============   DELETE BOX  =============== -->
    <rich:popupPanel id="currencyDelete">
        <f:facet name="header">currency delete confirmation</f:facet>
        <f:facet name="controls">
            <h:outputLink value="#"
                onclick="#{rich:component('currencyDelete')}.hide(); return false;">
                X
             </h:outputLink>
        </f:facet>
        <h:form>
            <h:panelGrid id="currencyDeleteInfo">
                Do you want really to delete currency identified by: 
                <h:outputText
                    value="#{s2MCurrencyModel.selectedCurrency.currencyCode}" />

                <h:panelGroup>
                <a4j:commandButton value="Delete"
                    oncomplete="#{rich:component('currencyDelete')}.hide();return false"
                    action="#{s2mCurrencyCtrl.deleteCurrency()}"
                    render="currencyDataTable"
                    />
                    **<rich:notify detail="#{s2MCurrencyModel.message}" stayTime="5000" summary="Notification" showShadow="true" />**
                <h:button value="Cancel" onclick="#{rich:component('currencyDelete')}.hide(); return false;"/>
                </h:panelGroup>
            </h:panelGrid>
        </h:form>
    </rich:popupPanel>

                    render="currencyDataTable"
                    />
                    <rich:notify detail="#{myModel.message}" stayTime="5000" />

deleteCurrency() メソッドで myModel.message を設定します。

よろしく、

4

1 に答える 1

0

次のように、コマンド ボタンのアクションにaFacesMessageを追加するだけです。FacesContext

public void deleteCurrency(){
//your other operations
FacesContext ctx = this.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO,"Detail","Summary"); //FacesMessage has other info levels
ctx.addMessage(null,msg);
}
于 2013-04-03T12:40:50.240 に答える