注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿弥陀佛

街树飘影未见尘 潭月潜水了无声 般若观照心空静...

 
 
 

日志

 
 
关于我

一直从事气象预报、服务建模实践应用。 注重气象物理场、实况场、地理信息、本体知识库、分布式气象内容管理系统建立。 对Barnes客观分析, 小波,计算神经网络、信任传播、贝叶斯推理、专家系统、网络本体语言有一定体会。 一直使用Java、Delphi、Prolog、SQL编程。

网易考拉推荐

PrimeFaces 3.0 Tree Node Event  

2012-01-13 21:43:57|  分类: JavaServer Faces |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Ajax Events as Behaviors

PrimeFaces provides various component callbacks to respond certains events, for example dialog has a server side closeListener and an attribute like onCloseUpdate. Similarly datatable has rowSelectListener with onRowSelectUpdate option. That is how we are implementing the callbacks, well… until now. The problem with current approach is limiting the page author to use partial processing since there is no onCloseProcess or onRowSelectProcess, also various options like global(flag to notify ajaxStatus), async, disabled are not available. I’ve received many feedback from users regarding this limitation and was planning to use JSF 2.0′s behavior APIs to solve this. After doing a proof of concept work, results are just fine.

Consider a tree component’s nodeSelect event, following is how we do it in 2.x;

1
<p:tree nodeSelectListener="#{bean.handleSelect}"; onNodeSelectUpdate="sth" ... >

And how it will be in 3.0;

1
2
3
<p:tree ...>
    <p:ajax event="nodeSelect" listener="#{bean.handleSelect}" update="sth" /&gt;
</p:tree>

Biggest advantage is since you use p:ajax, you can take advantage of handy options like global, async, disabled, oncomplete and we can avoid attribute hell.

Initial implementation of the new approach is at charts item select demo.

There are two important things to note, f:ajax is not supported instead p:ajax and this change breaks backward compatibility but the flexibility it brings justifies it.

This entry was posted in Developer, Java, PrimeFaces. Bookmark the permalink.

14 thoughts on “Ajax Events as Behaviors

  1. bitec on said:

    Marvellous! A very good approach, which would reduce the quantity of attributes for components and increase flexibility. Frankly speaking I had problems with f:ajax, and try to use p:ajax usually and I would agree, that flexibility is more important, than backward compatibility. JSF as any JCP driven standard is awkward to innovations and enhancments and different ui frameworks should not restrict themselves to this area.
    It would be great to mark components attributes as deprecated, though don’t remember, whether the taglibs allow to do this as well as modern IDES – to display…


  评论这张
 
阅读(1586)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017