tree.uispin.html 1017 Bytes
<ui:createLink 
		ui:format="json" 
		ui:sendQueryGraph="true" 
		ui:snippet="true" 
		ui:view="{= ?dataProvider }">

	<!-- The div that will be turned into a jsTree below -->
	<div id="{= ?id }" />

	<script type="text/javascript">
	$(function () {
		$("#{= ?id }").jstree({
			
			"plugins" : [ 
					"themes", 
					"json_data", 
					"ui", 
					"crrm", 
					"cookies", 
					"search", 
					"types", 
					"hotkeys" ],

			"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: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>
	
	</script>
</ui:createLink>