Introduction
dynatree-for-jsf is a JSF 2 adapter for dynatree jQuery plugin (http://code.google.com/p/dynatree/). dynatree allows to dynamically create html tree view controls using JavaScript.Why this adapter though Richfaces or Primefaces already implements> tree components ? Because dynatree has more features, is more mature, robust and is a prooven component.
Source code and sample are available on https://github.com/nithril/dynatree-for-jsf
Sample is running on Cloudbees at http://dynatree.nithril.cloudbees.net/tree.jsf
Features
This adapter handles events for all of the dynatree events. All events can be mapped to JSF ajax events.Here is a typical use of the adapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<q:dynatree id="myTree" options="{autoCollapse:'true'}" children="#{treeBean.child}" onActivate="alert('activate')" onLazyRead="alert('lazyRead')"> | |
<f:ajax event="onLazyRead" listener="#{treeBean.lazyRead}" onevent="function(response){cmp.onLazyRead_OnEvent(response,option.node);}"/> | |
<f:ajax event="onActivate" listener="#{treeBean.activate}" render="keyNode"/> | |
</q:dynatree> |
- lazyRead populates the tree dynamicaly.
- activate refresh a JSF panel with the selected node key.
This project does not include jquery, nor dynatree. You should include their by yourself.
Example
I have create an example with an infinite ajax tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvn clean install -P mojarra / -P myfaces | |
cd jetty-sample | |
mvn jetty:run -P mojarra / -P myfaces |
