My favorites | Sign in
Project Home Downloads
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 186 attachment: ErrorUnselectableWithParents.htm (3.1 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Dynatree - Example</title>
<script src="../jquery/jquery.js" type="text/javascript"></script>

<script src="../jquery/jquery-ui.custom.js" type="text/javascript"></script>

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

<link href="../src/skin/ui.dynatree.css" rel="stylesheet" type="text/css" id="skinSheet">

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

<script type="text/javascript">
var treeData = [
{title: "item1 with key and tooltip", tooltip: "Look, a tool tip!" },
{title: "item2: selected on init", select: true },
{title: "Folder", isFolder: true, key: "id3",
children: [
{title: "Sub-item 3.1",
children: [
{title: "Sub-item 3.1.1", key: "id3.1.1" },
{title: "Sub-item 3.1.2", key: "id3.1.2" }
]
},
{title: "Sub-item 3.2",
children: [
{title: "Sub-item 3.2.1", key: "id3.2.1" },
{title: "Sub-item 3.2.2", key: "id3.2.2" }
]
}
]
},
{title: "Document with some children (expanded on init)", key: "id4", expand: true,
children: [
{title: "Sub-item 4.1 (active on init)", activate: true,
children: [
{title: "Sub-item 4.1.1", key: "id4.1.1" },
{title: "Sub-item 4.1.2 (unselectable)", key: "id4.1.2", unselectable: true }
]
},
{title: "Sub-item 4.2 (selected on init)", expand: true,
children: [
{title: "Sub-item 4.2.1", key: "id4.2.1" },
{ title: "Sub-item 4.2.2 (unselectable)", key: "id4.2.2", unselectable: true }
]
},
{title: "Sub-item 4.3 (hideCheckbox)", hideCheckbox: true },
{title: "Sub-item 4.4 (unselectable)", unselectable: true }
]
}
];
$(function(){

$("#tree2").dynatree({
checkbox: true,
selectMode: 3,
children: treeData,
onSelect: function(select, node) {
// Display list of selected nodes
var selNodes = node.tree.getSelectedNodes();
// convert to title/key array
var selKeys = $.map(selNodes, function(node){
return "[" + node.data.key + "]: '" + node.data.title + "'";
});
$("#echoSelection2").text(selKeys.join(", "));
},
onClick: function(node, event) {
// We should not toggle, if target was "checkbox", because this
// would result in double-toggle (i.e. no toggle)
if( node.getEventTargetType(event) == "title" )
node.toggleSelect();
},
onKeydown: function(node, event) {
if( event.which == 32 ) {
node.toggleSelect();
return false;
}
},
// The following options are only required, if we have more than one tree on one page:
cookieId: "dynatree-Cb2",
idPrefix: "dynatree-Cb2-"
});


});
</script>

</head>
<body class="example">
<h1>
Example: Selection and checkbox</h1>
<!-- Tree #2 -->
<div id="tree2">
</div>
</body>
</html>
Powered by Google Project Hosting