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");
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值