tree.uispin.html
1.12 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
<ui:createLink
ui:format="json"
ui:sendQueryGraph="true"
ui:snippet="true"
ui:view="{= ?dataProvider }"
arg:root="{= ?root }">
<div id="{= ?id }" treedataprovider="{= ?dataProvider }" treeroot="{= ?root }"/>
<script type="text/javascript">
$(function () {
$("#{= ?id }").jstree({
"plugins" : [
"themes",
"json_data",
"ui" ],
"json_data" : {
"ajax" : {
"url" : '{= ?link }',
"async" : true,
"data" : function (n) {
return {
"id" : n.attr ? n.attr("id").replace("node_","") : 1
};
}
}
},
"core" : {
"animation" : 0
},
"themes" : {
"theme" : "classic"
},
"ui": {
"select_limit": 1
}
});
});
<ui:if ui:condition="{= bound(?onSelect) }">
$("#{= ?id }").bind("select_node.jstree", function(event, data) {
var node = data.rslt.obj.attr("id");
var resource = data.rslt.obj.attr("resource");
{= ?onSelect }
});
</ui:if>
<ui:if ui:condition="{= bound(?onLoaded) }">
$("#{= ?id }").bind("loaded.jstree", function(event, data) {
{= ?onLoaded }
});
</ui:if>
</script>
</ui:createLink>