[英]Ajax update does not work
為什么#{uImanager.select}
從未更新?
<p:panel id="EditDetailsPanel" header="Edit Details">
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel value="Simple :" />
<h:selectOneMenu value="#{uImanager.select}">
<f:selectItem itemValue="val1" itemLabel="Coffee1" />
<f:selectItem itemValue="val2" itemLabel="Coffee2" />
<f:selectItem itemValue="val3" itemLabel="Coffee3" />
</h:selectOneMenu>
</h:panelGrid>
<p:commandButton value="Submit" update="EditDetailsForm:EditDetailsPanel"/>
#{uImanager.select}
</p:panel>
它指向一個private String Select;
與吸氣劑和二傳手。 它是在會話范圍內的托管bean中定義的。
因為您的update
屬性可能指向無效的客戶端ID。 如果您關注服務器日志,那么您應該已經從PrimeFaces中看到了以下內容:
INFO: Cannot find component with identifier "EditDetailsForm:EditDetailsPanel" in view.
由於<p:panel>
與<p:commandButton>
本身位於同一UINamingContainer
父級中(至少根據到目前為止已發布的代碼),因此只需指定其相對的客戶端ID:
<p:commandButton value="Submit" update="EditDetailsPanel"/>
或者,如果你在指定的絕對委托人身份證堅持,那么你需要用前綴它:
:
<p:commandButton value="Submit" update=":EditDetailsForm:EditDetailsPanel"/>
請注意,這僅在<h:form>
本身沒有另一個UINamingContainer
父級的情況下有效。 在瀏覽器中打開頁面,右鍵單擊並查看源代碼以查看生成的HTML元素ID。 最后,你需要采取的值,前綴:
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.