About a week ago I released version 2.0 of TreeView, a PHP class for adding expandable tree controls to web applications. This is actually a big milestone toward my goal of building Ajax support. The major new features in TreeView 2.0 are:
Client-side mode
I coded the Javascript to animate the expanding and collapsing of nodes from the ground-up. The result is a highly responsive and smooth expanding tree without any page reloading. The code is very clean and works in both IE and Firefox on Windows.
PHP Session Support
It used to be that the more nodes you open, the longer query string became. Now you can enable session support to keep track of the open nodes and keep the query string very short.
Why Ajax?
Although client-side trees are great, it isn’t very practical for large trees because all of the nodes must be printed when the page first loads. If you have ten thousand nodes, you could end up with a long download and may even overwhelm the web browser. Usually people that have large trees give up on a client-side tree and go with page reloading instead.
With Ajax it is possible to eliminate the need to print all the nodes to the page at once and also eliminate page reloading. Ajax can retrieve the child nodes exactly when the user expands a node and then display them. It’s the ultimately efficient tree!
Update (2005/11/25): If you’re a Mac user, let me know if it works in IE for Mac, Safari, and/or Camino.