码迷,mamicode.com
首页 > 其他好文 > 详细

zTree 显示为‘aa’,当选择aa时,传的参数为‘22’

时间:2017-08-06 19:34:23      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:func   count   check   int()   ini   bsp   cte   ble   参数   

var setting = {
view: {

selectedMulti: false
},
check: {
enable: true

//初始化树
function treeInt(){
$(‘#treeDemo‘).empty();
$.ajax({
type:"get",
// url:"/styles/js/mock_data/inspect/task_tree.json",
url:"/api/inspect/getTaskTree",
dataType:‘json‘,
async:true,
success:function(response){

if(response.code==200){

var data = response.data;


function tree(m){
var nodes = [];
if(m.length !== 0){

$.each(data, function(i,v) {
var obj = {};
obj.name = v.displayName;
obj.t = v.fullName;
obj.open = true;
// obj.icon = "../../../css/zTreeStyle/img/diy/treeIcon.png";
if(v.subNodes !== null){
obj.children = [];
$.each(v.subNodes, function(a,b) {
var objOne = {};

objOne.name = b.displayName;
objOne.t = b.fullName;
objOne.open = true;
// objOne.icon = "../../../css/zTreeStyle/img/diy/treeIcon.png";


if(b.subNodes !== null){
objOne.children = [];
$.each(b.subNodes, function(z,l) {
var objTwo = {};
objTwo.name = l.displayName;
objTwo.t = l.fullName;                    //在这里构造数据时,加个  下面设置t字段 displayName它是显示用的,fullName它是传给后端的
objOne.children.push(objTwo);
});
}
obj.children.push(objOne);
});
nodes.push(obj);
} else {
obj.isParent = true;
nodes.push(obj);
}
});

return nodes;
}
}

// console.log(tree(data));
var setting = {
view: {

selectedMulti: false
},
check: {
enable: true
,chkStyle: ‘checkbox‘
,radioType: "level"
},
data: {
key: {
title: "t"             //在这里设置关键的t字段
}
}
// data: {
// simpleData: {
// enable: true
// }
// },
// edit: {
// enable: true
// }
};

function setCheck() {
setting.check.chkStyle = $("#r1").attr("checked")? "checkbox":"checkbox";
setting.check.enable = (!$("#disablechk").attr("checked"));
$.fn.zTree.init($("#treeDemo"), setting, tree(data));
}
$(document).ready(function(){
$.fn.zTree.init($("#treeDemo"), setting, tree(data));
setCheck();

});




}
}
});
}

 

 

取的时候   var checkedList = $(‘#treeDemo>li>ul>li>ul>li>span[class~="checkbox_true_full"]‘);

 

$(checkedList[i]).next()[0].title

 

 

$(‘.strCount‘).fadeIn(42).html(‘您最多能输入64字符,现已超出‘+beyond+‘字符‘).fadeOut(2000)

zTree 显示为‘aa’,当选择aa时,传的参数为‘22’

标签:func   count   check   int()   ini   bsp   cte   ble   参数   

原文地址:http://www.cnblogs.com/zjpzjp/p/7295500.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!