Now i’m using dtree.js for my treeview on my page, but it’s showing on the top (i’m using rails asset pipeline, and writed this code in other js file (not in haml))…
But it’s appending to document, but i need to some class or id, moreover, in jquery look-like code in some cases i must hide all this tree, i don’t know how to do this in siple js, only on jquery. But this is very good tree for my app, could’not change it.
Or is it any good tree with same way of adding data (for example: id, par id, link, name) ? Without any json-look like code etc…
amiscompany = new dTree('amiscompany');
amiscompany.add(10001,-1,'<a style="text-decoration:underline;" onclick="fade();" rel="nofollow" href="/search_trees/category/cat=">Каталог запчастей</a>');
amiscompany.add(10441,10001,'Внутренняя отделка',"/search_trees/category/cat=10441?SEL=1");
amiscompany.add(12797,10441,'Багажник / помещение для груза',"/search_trees/category/cat=12797?SEL=2");
amiscompany.add(10830,10441,'Комплектующие',"/search_trees/category/cat=10830?SEL=3");
.....
document.write(amiscompany);
amiscompany.openTo(0, true);
The best way to write your tree is to generate a
<ul>and<li>directly in whatever server-side language you are using. This makes your web site fully visible to Google.You can do things like you want with the
dTreelibrary. I played with it once, but found it too hard to control to my liking.I know you said you didn’t want something that looked like
JSONbut you didn’t explain why. If you are going to write your own function to do things,JSONreally is the cleanest way and you can have it generate and build your list. UsinglocalStorageyou can even remember which tree items were expanded or closed and render the tree in the same shape from page to page.