1
回答
ztree不显示编辑按钮
注册华为云得mate10,2.9折抢先购!>>>   
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>  
<html>
<head>
<base href="<%=basePath%>">  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath%>js/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" href="<%=basePath%>ztree/css/demo.css" type="text/css">
<link rel="stylesheet" href="<%=basePath%>ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="<%=basePath%>ztree/js/jquery.ztree.core-3.5.js"></script>
<title>Insert title here</title>
<script type="text/javascript">
	
	var setting = {
			edit: {
				enable: true,
				showRemoveBtn: true
			},
			data: {
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey: "pid",
					rootPId: 0
				}
			},
			callback: {
				beforeRemove: zTreeBeforeRemove
			}

	};
		
	var zNodes;
	
	$(function(){
		
		$("#showtree").click(function(){
			$.ajax({
				   type: "POST",
				   url: "<%=basePath%>food/list",
				   data: "",
				   success: function(msg){
						zNodes =msg;
						$.fn.zTree.init($("#treeDemo"), setting, zNodes);
				   }
				});
		});
	})
	
	function zTreeBeforeRemove(treeId, treeNode){
		alert(treeId);
	}
</script>

</head>
<body>
	<input type="button" value="显示树" id="showtree">
	<div class="zTreeDemoBackground left">
		<ul id="treeDemo" class="ztree"></ul>
	</div>
</body>

</html>

树显示正确,但是不显示编辑按钮,很奇怪,到底是哪里出了问题了呢?



举报
薄暮凉年
发帖于2年前 1回/1K+阅
顶部