ztree异步加载无法得到autoparam传的值,求帮忙
var setting = {
async:{
autoParam:["id"],
contentType:"application/json",
dataFilter: dataFilter,
dataType:"json",
enable:true,
type:"post",
url:"/domain/pss/customer/findSubNode.html"
},
data:{
key:{
name:"name"
},
simpleData :{
enable:true,
idKey:"id",
pIdKey:"parentid"
}
},
callback:{
onClick:findSubNode,
onAsyncSuccess: zTreeOnAsyncSuccess
},
view: {
expandSpeed: "fast",
selectedMulti:false,
showIcon:true,
showLine:true,
showTitle:true
}
};
$.post("/domain/pss/customer/findCusCategory.html",function(jsonData){
for(var i=0;i<jsonData.length;i=i+1){
if(jsonData[i].isleaf==1){
// jsonData[i].open=false;
jsonData[i].isParent=false;
}else{
// jsonData[i].open=true;
jsonData[i].isParent=true;
}
}
$.fn.zTree.init($("#treeData"),setting,jsonData);
},"json");
代码如上,在后台得不到穿的值Id,求大神解释
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
var setting = {
view: {
dblClickExpand: false,
removeHoverDom: removeHoverDom,
showLine: true
},
data: {
keep: {
parent: true,
leaf:true
},
simpleData:{
enable: true,
idKey:"id",
pIdKey :"pId",
rootPId:"0"
}
},
async: {
enable: true,
autoParam:["id","name","pId"],
contentType:"application/x-www-form-urlencoded",
dataType:"json",
url:"../asyncServlet",
dataFilter: filter,
type: "post"
},
callback: {
onClick: onClick,
beforeRemove: beforeRemove,
onRemove: removeTreeNode,
beforeAsync: zTreeBeforeAsync,
onAsyncSuccess:zTreeOnAsyncSuccess
}
};
我是这样写的,在servlet中String id = request.getParameter("id");得到的id是null,哪儿错了,求大神指点
怎么解决的?
谢谢,解决了
var setting = {
async:{
autoParam:["id"],
contentType:"application/x-www-form-urlencoded",
dataFilter: dataFilter,
dataType:"json",
enable:true,
type:"post",
url:"/domain/pss/customer/findCusCategory.html"
},
data:{
key:{
name:"name"
},
simpleData :{
enable:true,
idKey:"id",
pIdKey:"parentid"
}
},
callback:{
onClick:findSubNode
}
};
$(document).ready(function(){
$.fn.zTree.init($("#treeData"),setting);
});
你看看demo,你自己理解错了
autoParam : ["id=treeNode.ids"]
这个表示树节点异步加载的时候传到后台的节点id的key是多少,比如我写成treeNode.ids,那在后台就是request.getParameter("treeNode.ids"),明白不