jquery.jstree学习笔记

SSH +Jquery

 

jsTree.v.1.0rc2

 

<style type="text/css">
	html, body { margin:0; padding:0; }
	body, td, th, pre, code, select, option, input, textarea { font-family:verdana,arial,sans-serif; font-size:10px; }
	.demo, .demo input, .jstree-dnd-helper, #vakata-contextmenu { font-size:10px; font-family:Verdana; }
	#container { width:780px; margin:10px auto; overflow:hidden; position:relative; }
	#demo { width:auto; height:400px; overflow:auto; border:1px solid gray; }
	#text { margin-top:1px; }
	#alog { font-size:9px !important; margin:5px; border:1px solid silver; }
	</style>
</head>
<body>
<div id="demo" class="demo"></div>
<input type="hidden" id="path" value="<s:property value="#attr['contentPath']"/>"/>
<script type="text/javascript">

$(function () {
	$.jstree._themes = $("#path").val()+"/js/jstree/themes/";
	$("#demo").jstree({ 
		"json_data" : {
			data : <s:property value="#request.json" escape="false"/>
		},
		"plugins" : [ "themes", "json_data", "checkbox"]
	});
});
</script>
 
var nodes=$("#demo").jstree("get_checked");
	if(nodes.length > 0){
		$.each(nodes, function(i, n) {
	                guids += $(n).attr("id")+"@"+$(n).attr("nodetype")+"#";
	         });
		 $.getJSON('memberJSON!addTemplateUser.action',{'guids' : guids,'tempId' : $("#tempnum").val()},function(json){
	              if(json.result){
	                  openTo('sl-tab-content','frame.action?templateId=' + $("#tempnum").val());
		      }
	          });
}
 
[{'attr':{'id':'5','nodetype':'g'},'data':'还要测试','children':[{'attr':{'id':'1','nodetype':'u'},'data':'刘喜杰','icon':'/BDMOP3_MMS/js/jstree/leaf.png'},{'attr':{'id':'3','nodetype':'u'},'data':'wch','icon':'/BDMOP3_MMS/js/jstree/leaf.png'},{'attr':{'id':'4','nodetype':'u'},'data':'test','icon':'/BDMOP3_MMS/js/jstree/leaf.png'},{'attr':{'id':'5','nodetype':'u'},'data':'魏春辉','icon':'/BDMOP3_MMS/js/jstree/leaf.png'},{'attr':{'id':'2','nodetype':'u'},'data':'weichunhui','icon':'/BDMOP3_MMS/js/jstree/leaf.png'}],'icon':'/BDMOP3_MMS/js/jstree/folder.png'}]

 

/*if(!m.icon && js.icon) { m.icon = js.icon; }
						if(m.icon) { 
							if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
							else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
						}*/
						
						tmp.children("ins").css("background","url('" + js.icon + "') center center no-repeat");
 

 

你可能感兴趣的:(JavaScript,jquery,json,css,ssh)