Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Lawrence on Apr 15, 2009 04:36
open dhtmlx forum
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 http://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?
Answer posted by Alex on Apr 15, 2009 06:26

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.

Answer posted by Lawrence on Apr 15, 2009 07:23
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.

Thnx.

Answer posted by Alex on Apr 15, 2009 09:24

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.

Answer posted by Lawrence on Apr 15, 2009 10:41
Is it possible you give me any sample coding to do it?

I've tried several methods, but it didn't work thus far...

Thnx
Answer posted by Alex (support) on Apr 16, 2009 01:53

Ok, a small example:

document.getElementById("newParentId").appendChild(document.getElementById("treebox"));

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.

Answer posted by Lawrence on Apr 16, 2009 06:41
Unfortunately, with much testing, append didn't work as well..

Any other ideas?

Thnx
Answer posted by Alex on Apr 17, 2009 01:12
The provide approach must work. I have attached the example.
Attachments (1)
Answer posted by Lawrence on Apr 17, 2009 02:46
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.
Answer posted by Alex on Apr 17, 2009 06:00

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.