如何动态设置setting.check.chkStyle的值
ztree吧
全部回复
仅看楼主
level 1
slime童鞋 楼主
//配置信息
var setting = {
data: {
simpleData: {enable: true,idKey: "id",pIdKey: "pId",rootPId: 0}
},
check: {
enable: true,
chkStyle: "radio",
//chkStyle:function(){if($("#multiSelect").val() == "0"){return "radio";}else{return "checkbox";}},
radioType: "all"
}
};
-----------------------------------------------------------
setting.check.chkStyle是用来决定是单选还是多选的
我想在树加载前动态生成它的值(radio/checkbox),而不是像chkStyle: "radio"这样写死
就是根据URL&multiSelect=0中multiSelect的值是0还是1来决定树节点是单选还是多选
该怎么实现动态设置chkStyle的值?
我注释掉的那行代码是无效的......
2014年12月02日 00点12分 1
level 1
slime童鞋 楼主
不好意思,已经自己搞定了
//初始化树
function initTree()
{
multiSelect = $("#multiSelect").val();
if(multiSelect=="1"){setting.check.chkStyle="checkbox";}
$.fn.zTree.init($("#ztree"), setting,null);
zTree = $.fn.zTree.getZTreeObj("ztree");
}
2014年12月02日 01点12分 2
level 1
slime童鞋 楼主
async: {
enable: true,
type: "post",
url: "/homepage.nsf/ajaxGetTreeNodesInfoForSelect?openAgent",
dataType: "json",
autoParam:["id=pId"]
//,otherParam:{"curUserName":function(){return curUserName;}}
}
--------------------
上面注释那行是可以的
2014年12月02日 01点12分 4
json值可以直接修改
2014年12月02日 01点12分
如果我想父级列表是复选框,子级是单选框,能写出吗
2015年11月26日 07点11分
1