1

I have created a jsTree dynamically, the tree is created from a web-service using string builder.

 Dim oSB As StringBuilder = New StringBuilder
  oSB.Append("<div id='main'>")
   SB.Append("<h4>JSTree</h4>") 
  oSB.Append("<ul id='browser' class='filetree'><li><span class='folder' >Folder         1</span> <ul><li><span class='file'>Item 1.1</span></li></ul></li><li><span c   class='folder'>Folder 2</span> <ul><li><span class='folder'>Subfolder 2.1</span><ul id='folder21'> <li><span class='file'>File 2.1.1</span></li><li><span class='file'>File 2.1.2</span></li></ul></li><li><span class='file'>File 2.2</span></li></ul></li><li class='closed'><span class='folder'>Folder 3 (closed at start)</span><ul><li><span class='file'>File 3.1</span></li>    <li><span class='file'>File 3.2</span></li></ul></li><li><span class='file'>File 4</span></li></ul>")
 oSB.Append("</div>")

The Tree is formed but the minimize and max of the nodes are missing, i think it might be the problem with script not loading or something because the same tree in html page works great. I am returning the tree to the Ajax as

 $("div").html(data.d);    

Can anybody help me out, what am i missing?

2
  • Could you create working jsfiddle? What is actually missing? Are min/max of nodes jsTree attributes? Commented Jan 23, 2013 at 1:41
  • Actually i am too new to coding, and stil new to jsfiddle, I do not know how to create it that too with web-service. I am using link Sample 1. the only change i made was creating the tree from code behind in web-service instead of html, the collapsable and expandable properties are not being applied. I think the js is not attached to this dynamically created tree. Commented Jan 23, 2013 at 3:57

1 Answer 1

1

Actually i got it, i had missed (a simple part)to call the treeview function after Ajax returns with the value.

 function OnLoadSectionSuccess(data) {
            $("#div").html(data.d);
            $("#div").treeview({
                animated: "fast",
                collapsed: true
            });            
    }

After i added this the tree is working fine. Anyways thanks for your time.

Cheers

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.