Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Re: building an HTML based tree UIby jreades (Friar) |
on Apr 18, 2001 at 19:41 UTC ( [id://73537]=note: print w/replies, xml ) | Need Help?? |
The best way to handle this (since you're asking on a Perl list) is really a mixture of Perl and JavaScript. You'll probably want to write your code in such a way as to have Perl populate the tree and then let the JS handle both display and current status. There are several ways to handle this, and you'll have to pick the one that best reflects your needs, but one way would be this:
By node I mean that a tree basically has nodes and branches, and you want to define a nice JS OO interface where you can basically say: 'Add this node to this branch' and have JS take care of the rendering and keep track of where everything belongs and what it's current state is. I have seen code that does this, and perhaps some of the examples above will cover it, but I don't have anything to hand. If you don't want to use frames, then another way to handle this might be via some form of SSI (note: I think that this would be inefficient, but I have a thing against frames on the whole) whereby your JS tree serializes its state using a cookie that gets passed back to the server. The server reads the cookie and could modify as necessary. It's ugly, but it might work. Part of your JS code should also handle dynamically adding and removing nodes from the tree -- shouldn't be too hard if you've got a good interface.
In Section
Seekers of Perl Wisdom
|
|