My favorites
▼
|
Sign in
dynatree
Dynatree is a JavaScript dynamic tree view plugin for jQuery with support for persistence, keyboard, checkboxes, drag'n'drop, and lazy loading.
Project Home
Downloads
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
146
attachment: samplecode.txt
(8.2 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
$(function () {
$("#tree").dynatree({
rootVisible: false,
persist: true,
// Pass an array of nodes (and child nodes)
children: [
{ title: "Root", isFolder: true, key: "folder2"
,
children: [
]
}
],
onActivate: function (dtnode) {
// This function is called, when a node is clicked
// A DynaTreeNode object is passed as argument.
if (dtnode.data.title == "Root") {
xmlFldrs.loadXML(getFolders());
// CALL TO USERDEFINED FUNCTION TO BUILD THE TREE PROGRAMMATICALLY
Buildtree();
}
}
});
});
function Buildtree() {
try {
var oNodeList = xmlData.documentElement.selectNodes("//Folders/Folder")
var count, count1;
count = oNodeList.length;
count1 = oNodeList.length;
// $("#tree").dynatree({ rootVisible: false, onActivate: function (dtnode) { alert("You activated " + dtnode); } });
var rootNode = $("#tree").dynatree("getRoot");
var iCount = 0;
if (rootNode.childList.length == 1) {
for (var i = 0; i < count; i++) {
if (xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[2].text == "1") {
if (i == 0 || (xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[0].text != xmlData.documentElement.selectNodes("//Folders/Folder")[i - 1].childNodes[0].text)) {
var ID = xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[0].text
var childNode = rootNode.addChild({ title: xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[1].text, tooltip: xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[1].text, isFolder: true, key: xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[0].text, onSelect: function (dtnode1) { alert("Test") },tooltip:"Test" });
for (var j = 0; j < count; j++) {
var jID = xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[0].text;
if (ID == xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[0].text) {
if (ID == xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[8].text) {
//HERE IS WHERE I AM ADDING THE CHILDNODE WITH ONSELECT EVENT WHICH IS NOT FIRING
var CNode = childNode.addChild({ title: xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[6].text, isFolder: false, key: xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[0].text, tooltip: "Test1"
, onSelect: function (dtnode) {
alert("TEst");
}
})
}
}
else if (ID == xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[3].text) {
if (j == 0 || xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[0].text != xmlData.documentElement.selectNodes("//Folders/Folder")[j - 1].childNodes[0].text)
var CNode = childNode.addChild({ title: xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[1].text, isFolder: true, key: xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[0].text, onSelect: function (dtnode1) { alert("Test") }, tooltip: "Test" })
}
}
}
}
else if (xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[2].text == "2") {
// var ID = xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[0].text;
var rnodeChildlist = rootNode.childList.length;
var jCount = 0, kCount = 0, lCount = 0;
for (var j = 1; j < rnodeChildlist; j++) {
var ID = xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[0].text;
if (rootNode.childList[j].childList != null) {
for (var k = 0; k < rootNode.childList[j].childList.length; k++) {
for (var l = 0; l < count; l++) {
if (rootNode.childList[j].childList[k].data.isFolder == true) {
if (rootNode.childList[j].childList[k].data.key == xmlData.documentElement.selectNodes("//Folders/Folder")[l].childNodes[8].text) {
if ( (lCount < l)) {
var cNode = rootNode.childList[j].childList[k].addChild({ select: true, title: xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[6].text, isFolder: false, key: xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[0].text, onSelect: function (dtnode1) { alert("Test") } })
}
}
else if (rootNode.childList[j].childList[k].data.key == xmlData.documentElement.selectNodes("//Folders/Folder")[l].childNodes[3].text) {
// alert( " Inside folder" + xmlData.documentElement.selectNodes("//Folders/Folder")[j].childNodes[6].text)
var cNode = rootNode.childList[j].childList[k].addChild({ title: xmlData.documentElement.selectNodes("//Folders/Folder")[l].childNodes[1].text, isFolder: true })
}
}
lCount = l;
}
kCount = k;
}
}
jCount = j;
}
}
else if (xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[2].text == "3") {debugger;
var rnodeChildlist = rootNode.childList.length;
for (var j = 1; j < rnodeChildlist; j++) {
if (rootNode.childList[j].childList != null) {
for (var k = 0; k < rootNode.childList[j].childList.length; k++) {
if (rootNode.childList[j].childList[k].data.isFolder == true) {
if (rootNode.childList[j].childList[k].data.key == xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[8].text){
var cNode = rootNode.childList[j].childList[k].addChild({ title: xmlData.documentElement.selectNodes("//Folders/Folder")[i].childNodes[6].text, isFolder: false })
}
}
}
}
}
}
iCount = i;
}
}
}
catch (e) {
var strError = "New";
}
finally {
}
}
Powered by
Google Project Hosting