如何在 f:actionlistener 事件后刷新页面
How to refresh page after f:actionlistener event
使用 JSF,我有一个 <ux:confirm>
标签,它有一个确认按钮。单击时会触发 actionListenerEvent。 faces 上下文中的页面和对象已更新,但是我有一个未更新的 bootstrap 手风琴。一个解决方案是刷新页面,这是我的问题。
<ux:confirm
ok="#{message.get('Label.Sim')}"
ajax="true"
render="form-consulta"
cancel="#{message.get('Label.Nao')}"
title="#{message.get('Label.Excluir')}"
message="#{message.get('Msg.DesejaExcluirRegistro')}"
>
<f:actionListener
for="onOkClick"
binding="#{bean.excluir()}"
/>
</ux:confirm>
好的,只需在 ajax 事件上添加一个 JavaScript 函数并使用 javascript.
稍微调用一个模板方法即可解决
<f:ajax
render="#{cc.attrs.render}"
disabled="#{not cc.attrs.ajax}"
onevent="onEventConfirm"
/>
function onEventConfirm(data) {
App.ajax.onEvent(App.view.block, null, null, App.view.unblock);
var status = data.status;
switch (status) {
case "complete":
if(shouldRefreshAfterConfirmation)
this.location.reload();
break;
}
}
使用 JSF,我有一个 <ux:confirm>
标签,它有一个确认按钮。单击时会触发 actionListenerEvent。 faces 上下文中的页面和对象已更新,但是我有一个未更新的 bootstrap 手风琴。一个解决方案是刷新页面,这是我的问题。
<ux:confirm
ok="#{message.get('Label.Sim')}"
ajax="true"
render="form-consulta"
cancel="#{message.get('Label.Nao')}"
title="#{message.get('Label.Excluir')}"
message="#{message.get('Msg.DesejaExcluirRegistro')}"
>
<f:actionListener
for="onOkClick"
binding="#{bean.excluir()}"
/>
</ux:confirm>
好的,只需在 ajax 事件上添加一个 JavaScript 函数并使用 javascript.
稍微调用一个模板方法即可解决<f:ajax
render="#{cc.attrs.render}"
disabled="#{not cc.attrs.ajax}"
onevent="onEventConfirm"
/>
function onEventConfirm(data) {
App.ajax.onEvent(App.view.block, null, null, App.view.unblock);
var status = data.status;
switch (status) {
case "complete":
if(shouldRefreshAfterConfirmation)
this.location.reload();
break;
}
}