RichFaces checkbox tree
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...
I guees it should be 开发者_如何转开发done using some javascript function called when users selects root node...
any ideas??
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>
Where _node.select(_node.selected) does all the job on server side.
精彩评论