为dwz扩展树形下拉框
发布日期:2021-04-30 21:09:24 浏览次数:97 分类:精选文章

本文共 3693 字,大约阅读时间需要 12 分钟。

??????????????????DWZ?????????????????????????????????DWZ???????????????????????????value??????????????????title????????????????????????????????????

??????

??????????????????????????????????????????

??????

?DWZ?index.jsp???????????????????????????????????????????????????????

??????

?combotree.js????????????????????????????

  • ??????????????????
  • ???????????????
  • ????????????????
  • ??????????

    jQuery.extend($.fn, {    combotree: function(options) {        var $this = $(this);        loadProxysInfo();        if ($this.val() != null && $this.val() != '') {            $this.before($('', {                className: 'combo-text',                style: 'float:left;display:block;width:' + $this.width() + 'px',                onclick: function() { showMenu($this); }            }).html($this.attr('title'));        } else {            $this.before($('', {                className: 'combo-text',                style: 'float:left;display:block;width:' + $this.width() + 'px',                onclick: function() { showMenu($this); }            }).html(rootNode.name));        }        $this.before($('', {            className: 'combo-arrow',            style: 'float:left',            onclick: function() { showMenu($this.prev()); }        }));        $this.hide();    }});// ???????????function loadProxysInfo() {    if (proxyTreeData.length === 0) {        $.ajax({            url: common.ctx + '/member/loadProxysInfo.do',            async: false,            dataType: 'json',            success: function(records) {                if (records !== null && records.length > 0) {                    rootNode = records[0];                    rootNode.name = records[0].proxysName;                    rootNode.id = records[0].proxyserial;                    rootNode.open = true;                    rootNode.children = [];                    if (records.length > 1) {                        $.each(records.slice(1), function(index, value) {                            if (value.proxyserial.length / 4 === rootNode.id.length / 4 + 1) {                                var subNode = {                                    name: value.proxysName,                                    id: value.proxyserial                                };                                rootNode.children.push(subNode);                                addNextNode(records, subNode);                            }                        });                    }                    proxyTreeData.push(rootNode);                    $.fn.zTree.init($('#combotree'), setting, proxyTreeData);                }            }        });    }}// ????????function showMenu($ctrl) {    var cityOffset1 = $ctrl.offset();    $('#menuContent').css({        width: $ctrl.width() + $ctrl.next().width(),        left: cityOffset1.left + 'px',        top: cityOffset1.top + $ctrl.outerHeight() + 'px'    }).slideDown('fast');    $('body').bind('mousedown', onBodyDown);}// ???????????function onBodyDown(event) {    if (!(event.target.id === 'menuBtn' || event.target.id === 'menuContent' || $(event.target).parents('#menuContent').length > 0)) {        hideMenu();    }}

    ???????????????????????????????????????????loadProxysInfo()???????????????????????????

    ??DWZ?????

    ???DWZ???????????????dwz.ui.js???????????????????

    // ??????????$("input.combotree", $p).combotree();// ??? accordion ????$('div.accordion', $p).each(function() {    var $this = $(this);    $this.accordion({        fillSpace: $this.attr('fillSpace'),        alwaysOpen: true,        active: 0    });});

    ??????

    ??????????????????????????????????

        

    ????

    ?????????????DWZ?????????????????????????????????????????????????????????????????????

    上一篇:史上最详细最简单的冒泡排序,一学就会,一看就懂,一面试就懵!
    下一篇:一名测试实习生的心路历程

    发表评论

    最新留言

    初次前来,多多关照!
    [***.217.46.12]2026年05月25日 17时15分33秒