zoukankan      html  css  js  c++  java
  • zTree 显示为‘aa’,当选择aa时,传的参数为‘22’

    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)

  • 相关阅读:
    JavaScript之美读书笔记一
    关于form与表单操作
    正则表达式中的字符转义
    [codeforces 391D2]Supercollider
    [AMPPZ 2013]Bytehattan
    [那些你所不知道的鬼畜写法]平衡树学习笔记
    [AHOI 2006][BZOJ 1269]文本编辑器editor
    [BZOJ 3622]已经没有什么好害怕的了
    [POI 2008]Mafia
    [POI 2008][BZOJ 1132]Tro
  • 原文地址:https://www.cnblogs.com/zjpzjp/p/7295500.html
Copyright © 2011-2022 走看看