我有對話框中的窗體,我需要在用戶單擊按鈕時更新它。按鈕用於顯示此表單中的新字段。對話框中默認不顯示字段(render="#{gettForBoolean}"
)。有沒有辦法在不丟失數據的情況下更新Primefaces表單?
當我試圖在backing bean中使用RequestContext.getCurrentInstance().update(formID);
並且總是所有的數據都沒有了。
我有對話框中的窗體,我需要在用戶單擊按鈕時更新它。按鈕用於顯示此表單中的新字段。對話框中默認不顯示字段(render="#{gettForBoolean}"
)。有沒有辦法在不丟失數據的情況下更新Primefaces表單?
當我試圖在backing bean中使用RequestContext.getCurrentInstance().update(formID);
並且總是所有的數據都沒有了。
問題解決。書寫時正常輸入不保存到變量,但它可以通過AJAX來完成:<p:ajax event="keyup" process="@widgetVar(inputID)"/>
的過程屬性避免你在AJAX丟失數據調用:
<p:ajax process="@form" update="formId" actionListener="#{bean.method}" />
'過程=「@形式」'是默認值:https://stackoverflow.com/questions/25339056/understanding-primefaces-process-update-and-jsf-fajax-execute-render-attributes – Kukeltje