wiki:SopUseJQuerytree

Demo

http://vm7.target.rug.nl/catalogue/molgenis.do?__target=main&select=LLcatalogueTreePlugin (test/test)

Location

/molgenis/src/org/molgenis/framework/ui/html/JQueryTreeView.java 
and /molgenis/src/org/molgenis/framework/ui/html/JQueryTreeViewElement.java
  • JQueryTreeView.java contains the constructor , renderTree() and toHtml().
  • The function renderTree() is used by toHtml() is order to print each specific node to html <li>.The function toHtml() is actually serving the whole tree if called .
  • Contains the css and js references as well as the jquery functionality.

About the tree: No Nodes collapsed explicitly. Node is manually closed then by giving its LI element a "closed"(/opened) CSS class. The animation is enabled, and the speed is "normal" (this can be modified). "Cookie" persistence enabled, causing the current tree state to be persisted. Dynamically adding a sub tree to the existing tree demonstrated.

How to instantiate and use it

  • Inside your plugin instantiate a tree object by calling
JQueryTreeView<JQueryTreeViewElement> treeView 
  • You will probably need a function like addingObjectsToTree which will actually create the JQueryTreeViewElemen and fill the JQueryTreeView.
  • For the purposes of the measurements tree in LLcatalogueTree plugin(/molgenis_apps/apps/lifelines/plugins/LLcatalogueTree) we have instantiated the JQuery tree in public class JQueryTreeViewElementMeasurement extends JQueryTreeViewElement{ where the elements of the tree are measurements.
  • There is an example in LLcatalogueTree
public void addingMeasurementTotree(List<String> c
  • Also public String getTreeView() { return treeView.toHtml(); } will call render the tree in your ftl.
Last modified 13 years ago Last modified on 2012-01-11T10:44:43+01:00