代码之家  ›  专栏  ›  技术社区  ›  Anil Vishnoi

JSF-AJAX请求不能与hx:panelDialog一起使用

  •  0
  • Anil Vishnoi  · 技术社区  · 16 年前

    我写了以下代码,

            <h:form id="PrefForm" >
            <hx:commandExButton id="preferenceButton" type="button" style="align:right;" value="#{nls.preferenceLink }" title="#{nls.preferenceLinkTitle}" >
                        <hx:behavior event="onclick" behaviorAction="get" targetAction="prefPanelGroup"></hx:behavior>
                        <hx:behavior event="onclick" behaviorAction="show;stop" targetAction="preferenceSet"></hx:behavior>
            </hx:commandExButton>
    
            <hx:panelDialog id="preferenceSet"    type="modal" styleClass="panelDialog" title="#{nls.preferenceDialogTitle}" >
                <h:outputText styleClass="panelStartMessage" style="display:block;" value="#{nls.preferenceDialogWindowText}" />
    
                <h:panelGroup id="prefPanelGroup" rendered="#{neoReport.hasSelectItem }" style="display:block;width:300px;height:360px;overflow:auto;" >
                    <hx:ajaxRefreshRequest id="refreshform" />
                    <h:selectManyCheckbox value="#{neoReport.selectedItems}" layout="pageDirection">
                            <f:selectItems value="#{neoReport.selectItems}" />
                    </h:selectManyCheckbox>
                </h:panelGroup> 
    
                <hx:panelBox id="noCommandWindow" rendered="#{!neoReport.hasSelectItem }" style="display:block;width:300px;height:50px;" layout="lineDirection"> 
                    <h:outputText styleClass="outputText" id="cmdInfo"    value="#{nls.noCommands}" />
                </hx:panelBox>
    
                <h:panelGroup id="buttonBox1" styleClass="panelStartBox" >
                        <hx:commandExButton id="submitPref"    styleClass="commandExButton" type="submit" value="#{nls.submit}" action="#{neoReport.action}">
                            <hx:behavior event="onclick" behaviorAction="hide"    targetAction="preferenceSet" id="behaviorSubmitPref" />
                        </hx:commandExButton>
                        <hx:commandExButton id="CancelPref"    styleClass="commandExButton" type="submit" value="#{nls.cancel}" action="neoReport">
                            <hx:behavior event="onclick" behaviorAction="hide"    targetAction="preferenceSet" id="behaviorCancelPref" />
                        </hx:commandExButton>
                </h:panelGroup>
             </hx:panelDialog>
        </h:form>
    

    <f:selectItems value="#{neoReport.selectItems}"
    

    但它不会呈现panelDialog进一步。如果我删除了“get”的行为,它将显示面板对话框,但不会显示更新的数据。所以我不知道我到底做错了什么给你。我可以吗有人帮忙吗?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Daniel Szalay    16 年前

    首先我不知道这是什么类型的标签库。你应该在标签和/或问题中指出。

    你应该只有一个 <hx:behavior> tag,为你做所有的工作。如果这样做,您应该有一个调用所有三个方法的方法。有没有可能用这些标签用类似AJAX的方式重新呈现多个组件 targetAction="prefPanelGroup, preferenceSet" ?

    preferenceSet 会引起 prefPanelGroup

    还有,重新招标 PrefPanel组 只有告诉 < 标记一个更精确的id,比如 "PrefForm:prefPanelGroup" .

    希望这有帮助,

    推荐文章