我对这两个命令按钮有疑问:加入和离开。
如果我点击离开,我想隐藏加入,反之亦然。
当我将 ajax 设置为 false 时,没有问题(但所有页面都是刷新的,我认为这不是最佳的)。
但是,当 ajax 属性在特定更新的情况下为 true 时(参见代码中的注释),渲染效果很好,但新按钮似乎变得不活动。如果我点击它,什么也不会发生(看起来是 actionListener 触发器,但视图没有刷新,我必须手动刷新才能看到区别)
谢谢阅读。
<h:form id="formWaitingList" rendered="#{connexion.connected}" >
<p:commandButton id="Join"
actionListener = "#{connexion.joinWaitingList()}"
rendered="#{!connexion.waiting}"
ajax="false"
<!-- ajax="true"
update="Join,Leave"-->
value="Join"/>
<p:commandButton id="Leave"
value="Leave"
ajax="false"
<!-- ajax="true"
udpate="Join,Leave"-->
rendered="#{connexion.waiting}"
actionListener ="#{connexion.leaveWaitingList()}" />
</h:form>