日期:2014-05-17  浏览次数:20455 次

Jquery动态加载Treeview树!
使用Jquery动态加载树并且排序,根节点定死为(XXX监控),三个父节点。
数据库中一个字段(system)标识。
这个字段的值为100的时候第一个父节点的显示值为"Win"然后把这行值所对应的IP显示在"Win"节点下面。
这个字段的值为200的时候第二个父节点的显示值为"Lin"然后把这行值所对应的IP显示在"Lin"节点下面。
这个字段的值为NULL的时候第三个父节点的显示值为"未监测",然后把这行值所对应的IP显示在未检测节点下面
数据库结构图。效果图
麻烦大家帮帮忙!
jquery 数据库 asp.net

------解决方案--------------------
.st_tree{ padding:10px;}

/* 超链接 */
.st_tree a{ text-decoration:none; }

/* 鼠标经过的超链接 */
.st_tree a:hover{ color:#f33; text-decoration:underline;}

/* 菜单 */
.st_tree ul{ padding:0 18px; margin:0; }

/* 菜单项 */
.st_tree ul li{ font-size:13px; color:#222; line-height:18px; cursor:pointer;list-style:none;
                background:url(imgs/st_node.gif); background-repeat:no-repeat; padding:0 0 3px 20px;
                width:120px;}

/* 子菜单 */
.st_tree ul li ul{}

/* 子菜单项 */
.st_tree ul li ul li{}

/* 子菜单的父节点 */
.st_tree .folder{ list-style-image:url(imgs/st_icon.png); background:url(imgs/st_folder.gif); 
                background-repeat:no-repeat; padding:0 0 0 20px;}

/* 展开的父节点 */
.st_tree .open{ list-style-image:url(imgs/st_icon_open.png); background:url(imgs/st_folder_open.gif); 
             background-repeat:no-repeat; padding:0 0 0 20px; }


$(function () {
    $.fn.extend({
        SimpleTree: function (options) {

            //参数初始化
            var option = $.extend({
                click: function (a) { }
            }, options);

            option.tree = this; /* 在参数对象中添加对当前菜单树的引用,以便在对象中使用该菜单树 */

            option._init = function () {
                /*
                * 初始化菜单展开状态,以及分叉节点的样式
                */
                this.tree.find("ul ul").hide(); /* 隐藏所有子级菜单 */
                this.tree.find("ul ul").prev("li").removeClass("open"); /* 移除所有子