【发布时间】:2021-01-25 00:06:58
【问题描述】:
单击 selectOneMenu 时 ajax 更新不起作用,并在我重新加载页面时更改教员进行更新
我已经搜索了一个小时但找不到任何解决方案 onChooseFaculty 方法运行良好但更新不是
<h:form id="home">
<p:sidebar id="homeSider" widgetVar="sidebar1">
<h2 style="font-weight: normal">Select Department</h2>
<br></br>
<h:panelGrid id="homePanel" columns="2" cellpadding="5">
<p:outputLabel for="faculty" value="Faculty: " />
<p:selectOneMenu id="faculty" value="#{homeBacking.selectdFaculty}"
style=" width:12em">
<p:ajax listener="#{homeBacking.onChooseFaculty}"
ignoreAutoUpdate="false" update=":home:department" />
<f:selectItem itemLabel="Select Faculty" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{homeBacking.faculty}" />
</p:selectOneMenu>
<p:outputLabel for="department" value="Department: " />
<p:selectOneMenu id="department"
value="#{homeBacking.selectedDepartment}" style="width:12em"
disabled="#{homeBacking.enableDept}">
<f:selectItem itemLabel="Select Department" itemValue=""
noSelectionOption="true" />
<f:selectItems value="#{homeBacking.department}" />
</p:selectOneMenu>
</h:panelGrid>
<p:separator />
<div class="container " align="center">
<p:commandButton value="Submit" update="" />
<p:commandButton value="Cancel" oncomplete="PF('sidebar1').hide()" />
</div>
</p:sidebar>
</h:form>
我试过了:
update=":home:homeS:homePanel:department"
update=":home:homeS:department"
update=":home:department"
update=":department"
update=":home"
update=":sidebar"
添加面板组并更新它 还有很多其他的东西
这是怎么回事?! 感谢您的帮助。
【问题讨论】:
-
尝试从后端更新,使用 PrimeFaces.ajax().update("componentId")
-
感谢所有的问题是 jsf impl 和 jsf api 不在同一个版本中
标签: jsf primefaces