jsUI-Treeview
var mytreeview = new Object();
mytreeview = treeviewNew("mytreeview", "default", document.getElementById("treeCell"), null);
mytreeview.itemClick = doClick;
mytreeview.itemExpand = loadBranch;
mytreeview.createItem("item1", "First Item", "../images/icon.jpg", true, true, true, null);
mytreeview.createItem("item1-1", "First Item Child", "../images/icon.jpg", true, true, true, "item1");
The treeview is a nested navigation control, based on those frequently found in Windows or the MacOS. It is compatible with Internet Explorer 5.0 and FireFox 1.0 or better.
jsUI-Global/common.js
jsUI-Global/uiCommon.js
jsUI-Treeview/component.js
index.htm
The DOM object to which the treeview is attached. Frequently a DIV or TD.
alert (mytreeview.treeviewParent.id);
DOM Object. This property is assigned on instantiation and is read only.
Gets or sets the string value representing the path to the root of the jsObjects directory. Used for calculating style and graphics file paths. Initially set during instantiation.
mytreeview.rootDir = "http://localhost/libraries/jsobjects";
http://<server>/jsObjects
String. This value only needs to be set if jsObjects is installed in a custom location.
Instantiates the treeview through assignment into a Javascript object.
Required. The name for the new treeview. Must match the name of an empty Javascript object to contain the treeview.
Optional. The name of the CSS (excluding the extension and path) file to use for the treeview. If left blank, "default" will be used.
Optional. The DOM object that the treeview is to be attached to. If no value is passed, the treeview will be appended to document.body
Optional. The path to the root of the jsObjects directory. If left blank, the default path will be used.
var mytreeview = new Object();
mytreeview = treeviewNew("mytreeview", "default", document.getElementById("treeviewDiv"), "../jsobjects");
The treeview object.
This is the only method that does not appear to be a member of the object -- because the object can't have members until it's instantiated. A blank object is created and will be filled with the jsUI-treeview members.
Creates a branch icon in the specified folder in the treeview.
Required. A unique string to be used as the DOM ID for the new tree item.
Required. The text that appears as the title of the new tree item.
Optional. The icon for the new tree item.
Required. Indicates whether or not there are children below the new tree item. If null is passed an "indeterminate" indicator is used to show the user that the heirarchy is not known until the item is expanded.
Required. Indicates whether or not the item has been pre-loaded. This is used to determine the show/hide behaviour of children. If a nodes children are populated by a local function, then preload is false, since that function can be called to re-populate the branch next time it is expanded. If, however, the branch was pre-loaded by server-side code, or some non-local function, the parent node's heirarchy will be preserved -- hidden and shown, on collapse/expand -- instead of being destroyed and re-created.
Required. Determines whether or not to show the item on the tree. If the item is a child of an un-expanded parent, then show should be false.
Required. The parent item to add the new item to. If omitted, the new item will be appended to the root item of the tree, or the last item on the root level.
mytreeview.createItem("item1", "First Item", "../images/icon.jpg", true, true, true, null);
Nothing
Fires whenever a item is clicked, passing the ID of target object, so that external code can respond.
mytreeview.itemClick = handler;
The handler should accept one string parameter which will contain the ID of the button clicked.
Fires whenever a tree branch expand action happens, passing the ID of target object, so that external code can respond by populating the target node's children.
mytreeview.itemExpand = handler;
The handler should accept one string parameter which will contain the ID of the button clicked.