Loading a tree from HTML


#1

Okay so I’m not sure if I’m understanding the creation of a tree from HTML correctly or not.

In a nutshell, I’ve created an unsorted list in HTML that I think I can display in a tree format? I’ve been reading the demo here:

dhtmlx.com/docs/products/dhtmlxT … _html.html

And this is where the confusion comes in. I know by calling mytree.loadXML(file.xml) I can pass in an XML file and life is good. But how do I load my HTML list I’ve created and turn it into a tree? I also see the:
var myHTML = dhtmlXTreeFromHTML(id);

line being referenced, and I’m assuming it will store my HTML list in the ‘myHTML’ variable, but how do I then get it into the tree? I feel like I’m missing a step. There should be a mytree.loadHTML or something like that.


#2

Hello
Could you provide us an HTML file with your tree?
We will inspect it to help you


#3

I’ve tried to attach a file that contains the html I created through code but keep getting messages that ‘extension .txt is not allowed’. Oh well, regardless all I did though was build an unsorted list through code and stored it in a variable called ‘myhtml’. I’d now like to have that displayed in a window in a tree format (hopefully). My code looks something like this:

myhtml = “

  • Office facing
  • Furniture installation
  • Interior office
”;

var dhxWins, w1, myTree;
dhxWins = new dhtmlXWindows();
w1 = dhxWins.createWindow(“pred”, 20, 30, 400, 280);
w1.setText(" My Tree");
myTree = w1.attachTree();
myTree.setImagePath("…/js/dhxtree_skyblue/");
//myTree.loadXML("…/js/tree.xml"); //And this is where I’m not sure how to get myHtml into a tree format.

That’s pretty much it, like I said I feel like I’m missing a step here and am making this tougher than it looks. I still need to figure out child nodes, etc so that I can expand and collapse the tree, but getting it to display is the first step :slight_smile:


#4

Forum allows to attach pictures and archives. You can zip your txt file to provide it


#5

ok. text file has been zipped and attached.
test.zip (185 Bytes)


#6

This is only one line in the txt:

"<ul><li>Office facing</li><li>Furniture installation</li><li>Interior office</li></ul>"

I meant the whole html page


#7

Ahh my apologies. Attached the entire html file.
Procedure_Scheduler.zip (4.78 KB)


#8

Cleared all the code except dhtmlxTree is needed in - and now your tree works. Please, see attached sample
tree.zip (401 KB)