Reddy
Reddy

Reputation: 1628

JStree view issue

I am trying get tree view in the web page. I am using jstree plugin for the tree view. I am actually new to jQuery. The following is the code i have written.

<%-- 
    Document   : folderView
    Created on : Nov 2, 2010, 3:31:55 PM
    Author     : Vamshidhar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>

    <head>
        <title>hi</title>
         <script type="text/javascript" src="jquery.jstree.js"></script>
        <script type="text/javascript" src="jquery.js"></script>

    </head>
    <body>

 <div id="demo1" class="demo"></div>

<script type="text/javascript">
$(function () {
 $("#demo1").jstree({
  "xml_data" : {
   "data" : "" +
"<root>" +
 "<item id='node_1'>" +
  "<content><name>Root node 1</name></content>" +
 "</item>" +
 "<item>" +
  "<content><name>Root node 2</name></content>" +
 "</item>" +
 "<item parent_id='node_1'>" +
  "<content><name>Child node</name></content>" +
 "</item>" +
"</root>"
  },
  "plugins" : [ "themes", "xml_data" ]
 });
});
</script>

    </body>
</html>

Can anyone help me figure out what is wrong?

Thanks in advance

Upvotes: 0

Views: 366

Answers (1)

user425445
user425445

Reputation:

Try changing the order of loading the js files it got things working for me.

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.jstree.js"></script>

Hope this helps, be happy

Upvotes: 2

Related Questions