我没有oncomplete
在标准JSF中的PrimeFaces中的某些标签中找到可用的属性<h:commandButton>
.
如何在使用时获得类似功能的完整功能<h:commandButton>
?
Dan*_*iel 10
由于primefaces oncomplete
相当于普通的JSF success
事件(有关详细信息,请查看此答案注释,您应该success
以下列方式使用该事件:
内联解决方案
<h:commandButton id="someId" action="#{myBean.myAction}">
<f:ajax onevent="function(data) { if (data.status === 'success') { alert('complete'); }"
render="whatevet"></f:ajax>
</h:commandButton>
Run Code Online (Sandbox Code Playgroud)
另一个更清洁的解决方案是使用js功能
<h:commandButton id="someId" action="#{myBean.myAction}">
<f:ajax onevent="myJsFunction"
render="whatevet"></f:ajax>
</h:commandButton>
Run Code Online (Sandbox Code Playgroud)
在你的js文件中添加
function myJsFunction(data) {
if (data.status === 'success') {
alert('complete');
}
}
Run Code Online (Sandbox Code Playgroud)
如果您正在寻找一种方法来检测非ajax提交的完成,您可以从这里采用以下想法检测浏览器中的文件下载对话框
最简单的解决方案是使用
$(document).ready(function () {
// check if some condition is meet and do something...
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
14978 次 |
最近记录: |