Primefaces AJAX callbacks: onstart vs. onclick
来源:互联网 发布:2012sql维护计划 编辑:程序博客网 时间:2024/06/05 02:08
Primefaces AJAX callbacks: onstart vs. onclick
I just learned the hard way that onstart and onclick are not the same thing.
In particular, a "return ..." has very different semantics in both cases.
Consider this code:
If "func()" return false, this code will abort the AJAX request and bean.method() won't get called.
If "func()" returns true, the AJAX request processes.
If you replace onstart with onclick, the AJAX request will abort even if func() returns true.
That's because the Primefaces puts the code to generate the AJAX request in the onclick handler, pre-pending your code from the p:commandLink onclick before it. If your code returns, the AJAX request never gets sent.
In particular, a "return ..." has very different semantics in both cases.
Consider this code:
<p:commandLink action="#{bean.method}" onstart="return func()" ...>
If "func()" return false, this code will abort the AJAX request and bean.method() won't get called.
If "func()" returns true, the AJAX request processes.
If you replace onstart with onclick, the AJAX request will abort even if func() returns true.
That's because the Primefaces puts the code to generate the AJAX request in the onclick handler, pre-pending your code from the p:commandLink onclick before it. If your code returns, the AJAX request never gets sent.
http://wrschneider.blogspot.com/2012/01/primefaces-ajax-callbacks-onstart-vs.html
- Primefaces AJAX callbacks: onstart vs. onclick
- PrimeFaces Ajax Callbacks [ (xhr, status, args) ]
- PrimeFaces vs RichFaces vs IceFaces
- onStart
- primefaces
- PrimeFaces
- Callbacks
- callbacks
- onclick vs addEventListener
- Android添加事件android:onClick vs setOnClickListener
- jQuery中AJAX与onclick绑定
- onstart事件
- PrimeFaces 3.0发布:面向JSF2的Ajax、移动与IE 9组件
- 理解PrimeFaces process/update和JSF f:ajax execute/render属性
- primefaces研究
- dataGrid(primefaces)
- dataScroller(primefaces)
- dataList(primefaces)
- silverlight的Datagrid的超复杂表头写法
- android实现点击短链接进入应用 并获得整个连接的内容
- 解决读取文件乱码问题小结
- ZOJ 3675 Trim the Nails(bfs+位运算处理)
- IOS_Xcode4.6制作framework
- Primefaces AJAX callbacks: onstart vs. onclick
- *.dat 文件自动设置ip地址
- 腾讯技术分享实录:游戏后台开发九问
- 使用cpufreq给CPU临时调整主频
- 使用jquery dataTable
- xcode 插件收集
- Duilib配置
- 英语学习一周有感
- 在企业环境发布iOS App的方法