RichFaces复选框树 [英] RichFaces checkbox tree
问题描述
我正在实现RichFaces复选框树,但是有一个问题...当用户选择根节点时,我需要将所有子节点标记为已选中...
I'm implementing RichFaces checkbox tree, and I've got a problem... I need to mark all the child nodes as selected when user selects root node...
我想应该使用一些当用户选择根节点时调用的javascript函数来完成它.
I guees it should be done using some javascript function called when users selects root node...
任何想法?
推荐答案
花了很多时间使用javascript之后,我决定转到服务器端. 因此,要实现上述功能,树节点将在每次单击时发送ajax请求,然后服务器端对所有子节点执行选择或取消选择,并在请求处理完成后重新呈现树组件.以下代码演示了单节点内容:
After spending a lot of time with javascript, I decided to move to server side. So, to implement the above feature tree nodes are sending ajax requests on each click, then server-side performs selection or deselection of all the child nodes, and after request processing is finished tree component gets rerendered. The following code demonstrates single node content:
<rich:tree id="tree" ...
<rich:treeNode ...
<h:selectBooleanCheckbox value="#{_node.selected}">
<a4j:support event="onclick" action="#{_node.select(_node.selected)}" reRender="tree">
</a4j:support>
</h:selectBooleanCheckbox>
</rich:treeNode>
</rich:tree>
_node.select(_node.selected)在服务器端完成所有工作的地方.
Where _node.select(_node.selected) does all the job on server side.
这篇关于RichFaces复选框树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!