Dhtmlxtree div problem?

I have a blog that uses the tree view as the layout for “archives”. However, I have a weird problem.

Please visit melswee.zopix.net/cityoflove.php.

If I let the thing initialize without being on the page, the tree view will refuse to expand or collapse.

If I click on the “past” tab before the tree view initializes (not fully loaded yet), the tree view is in working order (able to expand and collapse). However, the moment I start switching between the tabs (navigating around), the tree view will fail to work.

Anyone has any idea?

Please, try to initialize tree correctly.

Now, when you press “Past”, the innerHTML of the created tree is copied to the visible area. The tree must be initialized in the container where it is shown.

Sorry, I’m not very good in this area.

Does it mean I have to start it at the outer container (div) ? Because right now, I already initiate the script at its appropriate desired container.


If you just copy innerHTML of the tree, you we see the structure. But it isn’t the tree.

You can use appendChild method or another approach.

Is it possible you give me any sample coding to do it?

I’ve tried several methods, but it didn’t work thus far…


Ok, a small example:


Here “newParentId” is the id of the container where the tree must be placed. The “treebox” is the id of the container where tree is initialized.

Unfortunately, with much testing, append didn’t work as well…

Any other ideas?


The provide approach must work. I have attached the example.
1239901174.zip (41.5 KB)

Yes, technically, it works.

But in my case, it doesnt really works. This is because when you use appendChild, it “destroys” the element. This means that, you can only append it once, and there after, it will disappear if you switch between the divs.

What I need is, it able to switch between the div layers.  So base on that, are there other ways?

Thanks for the samples =) Very much appreciated.

Actually this issue doesn’t relate to tree itself. This is javascript issue …

The solution, that we provided you, can work in your case too. As you can move tree container in its previous place.