forked from liferay/alloy-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.html
executable file
·202 lines (180 loc) · 3.87 KB
/
index2.html
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html>
<head>
<script src="../../build/aui/aui.js" type="text/javascript"></script>
<link rel="stylesheet" href="../../build/aui-skin-classic/css/aui-skin-classic-all-min.css" type="text/css" media="screen" />
</head>
<style type="text/css" media="screen">
.aui-tree-view {
margin: 30px;
font-size: 12px;
}
#treeFromNodes {
margin: 30px;
}
#tree1 {
padding: 15px;
border: 3px solid #ededed;
}
#tree1-1 {
left: 300px;
position: absolute;
top: 100px;
}
</style>
<body>
<h1>Alloy - TreeView</h1>
<button id="expandAll-1">Expand All</button>
<button id="collapseAll-1">Collapse All</button>
<button id="createNodeROOT-1">Append node to ROOT</button>
<button id="insertBeforeROOT-1">Insert node before ROOT</button>
<h1>A.TreeView Folder Style</h1>
<div id="tree1"></div>
<div id="tree1-1"></div>
<br/><br/><br/>
<button id="expandAll-2">Expand All</button>
<button id="collapseAll-2">Collapse All</button>
<button id="createNodeROOT-2">Append node to ROOT</button>
<h1>A.TreeView Simple Style</h1>
<div id="tree2"></div>
<script type="text/javascript" charset="utf-8">
AUI().ready('aui-tree-view', 'aui-tooltip', 'datatype-xml', 'dataschema-xml', function(A) {
console.log(arguments);
new A.Tooltip({ trigger: '#tree1', bodyContent: 'Mouseover the tree to activate the Drag&Drop.', width: 150 }).render();
var defCallback = function(event) {
if (window.console && window.console.log) {
console.log(event.type, event);
}
};
// creating from constructor A.TreeNode
var fileRoot1 = new A.TreeNode({ label: 'File ROOT 1', id: 'fileRoot1' });
// or from json
var children = [
{
type: 'io',
label: 'CachedTreeNodeIO1',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO2',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO3',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO4',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO5',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO6',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO7',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO8',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO9',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO10',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO11',
cache: true,
io: 'assets/content.php'
},
{
type: 'io',
label: 'CachedTreeNodeIO12',
cache: true,
io: 'assets/content.php'
}
];
// display the nodes using the A.TreeView
// var tree1 = new A.TreeView({
var tree1 = new A.TreeViewDD({
paginator: {
alwaysVisible: true,
offsetParam: 'start',
limit: 3,
total: 1000
},
io: {
cache: false,
url: 'assets/content.php'
},
selectOnToggle: false,
type: 'file',
width: 200,
height: 400,
boundingBox: '#tree1',
on: {
// collapse: defCallback,
// expand: defCallback,
append: defCallback,
collapseAll: defCallback,
expandAll: defCallback,
// insert: defCallback,
move: defCallback,
remove: defCallback,
drop: defCallback
},
after: {
drop: function(event) {
var tree = event.tree;
// console.log(tree.dragNode.get('parentNode').indexOf(tree.dragNode));
},
// collapse: defCallback,
// expand: defCallback,
append: defCallback,
collapseAll: defCallback,
expandAll: defCallback,
// insert: defCallback,
move: defCallback,
remove: defCallback
},
children: children
}).render();
});
</script>
</body>
</html>