WokTiny

Google

AJAS Tree Test

This is a generic extendable Javascript tree library. JavaScript Source


MouseOver:
Click:

The Tree class is a subclass of UL, the constructor receives two optional parameters:

  1. A character to use as a path delimiter (default '/')
  2. A function to call after the default onclick event

The TreeNode class is a subclass of LI, the constructor receives two parameters:

  1. A String for the true name of the node
  2. An array/object of properties to add to the node

The example above demonstrates some augmentation:

  1. Node1 is created Implicitly because it does not exist when '/Node1/Node2' is created
  2. Node2 has a custom title attribute, created by added a title property to the second parameter
  3. Node3 has a custom label, different from its pathname, created by added a sLabel property to the second parameter
  4. Node4 has a custom onclick event handler that overrides the default click handler, created by passing a function as an onclick property of the second parameter
  5. Node5 has a custom onclick event handler that precedes the default click handler, created by passing a function as an onclick property of the second parameter