javascript - jQuery Fancy Tree with Local Array Data - Stack Overflow

I am trying to implement jQuery FancyTreewith local array dataReferred from This is the code. But i

I am trying to implement jQuery FancyTree / with local array data

Referred from /

This is the code. But it is not working, No Script Error.But Tree is empty!!!

Even i copied the jQuery, UI versions of the file they using in a demo site. Still nothing works

<html>
<head>
    <script src="jquery.js" type="text/javascript"></script>
    <script src="jquery-ui.custom.js" type="text/javascript"></script>
    <link href="ui.fancytree.css" rel="stylesheet" type="text/css" />
    <script src="jquery.fancytree.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tree").fancytree({
                onActivate: function (node) {
                    // A DynaTreeNode object is passed to the activation handler

                    // Note: we also get this event, if persistence is on, and the 
                     //  age is reloaded.
                    alert("You activated " + node.data.title);
                },

                children: [ // Pass an array of nodes.
                {title: "Item 1" },
                { title: "Folder 2", isFolder: true,
                    children: [
                        { title: "Sub-item 2.1" },
                        { title: "Sub-item 2.2" }
                    ]
                },
                { title: "Item 3" }
            ]
            });
        });

    </script>
</head>
<body>
    <div id="tree">
    </div>
</body>
</html>

I am trying to implement jQuery FancyTree http://wwwendt.de/tech/fancytree/demo/ with local array data

Referred from https://code.google./p/fancytree/

This is the code. But it is not working, No Script Error.But Tree is empty!!!

Even i copied the jQuery, UI versions of the file they using in a demo site. Still nothing works

<html>
<head>
    <script src="jquery.js" type="text/javascript"></script>
    <script src="jquery-ui.custom.js" type="text/javascript"></script>
    <link href="ui.fancytree.css" rel="stylesheet" type="text/css" />
    <script src="jquery.fancytree.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tree").fancytree({
                onActivate: function (node) {
                    // A DynaTreeNode object is passed to the activation handler

                    // Note: we also get this event, if persistence is on, and the 
                     //  age is reloaded.
                    alert("You activated " + node.data.title);
                },

                children: [ // Pass an array of nodes.
                {title: "Item 1" },
                { title: "Folder 2", isFolder: true,
                    children: [
                        { title: "Sub-item 2.1" },
                        { title: "Sub-item 2.2" }
                    ]
                },
                { title: "Item 3" }
            ]
            });
        });

    </script>
</head>
<body>
    <div id="tree">
    </div>
</body>
</html>
Share Improve this question asked Feb 14, 2013 at 15:16 BillaBilla 5,26623 gold badges66 silver badges108 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

I have noticed that source:[] is how you initializes the tree in $("#tabTree").fancytree() initialization call, so your example would be:

<html>
<head>
    <script src="jquery.js" type="text/javascript"></script>
    <script src="jquery-ui.custom.js" type="text/javascript"></script>
    <link href="ui.fancytree.css" rel="stylesheet" type="text/css" />
    <script src="jquery.fancytree.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tree").fancytree({
                onActivate: function (node) {
                    // A DynaTreeNode object is passed to the activation handler

                    // Note: we also get this event, if persistence is on, and the 
                     //  age is reloaded.
                    alert("You activated " + node.data.title);
                },
                source: [ // Pass an array of nodes.
                {title: "Item 1" },
                { title: "Folder 2", isFolder: true,
                    children: [
                        { title: "Sub-item 2.1" },
                        { title: "Sub-item 2.2" }
                    ]
                },
                { title: "Item 3" }
            ]
            });
        });

    </script>
</head>
<body>
    <div id="tree">
    </div>
</body>
</html>

btw, in case you noticed it, the documentation is quite messy, as they are refactoring the code, the documentation is half what's left from dynatree and the new conventions of fancytree. So expect more weird stuff like that :-)

are the Scriptpath right?

Do you download "jquery.js, jquery-ui.custom.js, ui.fancytree.css and jquery.fancytree.js" ?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745136793a4613241.html

相关推荐

  • javascript - jQuery Fancy Tree with Local Array Data - Stack Overflow

    I am trying to implement jQuery FancyTreewith local array dataReferred from This is the code. But i

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信