zoukankan      html  css  js  c++  java
  • eazasyui树形菜单

    //此处是easyui的json格式  
    var tree = {  
        id:'',  
        text:'',  
        state:'',  
        checked:'',  
        attributes:'',  
        children:''  
    }  
    //此处是把后台传过来的json数据转成easyui规定的格式  
    function bl(item){  
        var tree = new Object();  
        tree.id = item.id;  
        tree.text = item.name;  
        tree.state = 'open';  
        tree.checked = 'false';  
        tree.attributes = item.url;  
        if(item.child_menus.length != 0){  
            tree.children = jsonbl(item.child_menus);  
        }else{  
            tree.children = [];  
        }  
        return tree;  
    }  
    function jsonbl(data){  
        var easyTree = [];  
        $.each(data,function(index,item){  
         easyTree[index] = bl(item);  
         });  
        return easyTree;  
    }  
    //此处是easyui调用tree组件的方法(使用easyui的童鞋自然懂得,只需修改请求json的api即可)  
    $('#tt').tree({  
        url: '${pageContext.request.contextPath}/sysmenu/all',  
         loadFilter: function(data){   
            return jsonbl(data);   
        }  
    });  

    个人公众号:益起走

    hi

  • 相关阅读:
    <span>和<div>标签的隐藏和显示切换
    重启svn
    Mac下配置apache
    iOS时间显示今天昨天
    关于UIPageViewController那些事
    关于plist文件的那些事
    Xcode调试LLDB
    Reveal安装
    静态初始化器
    Static简介
  • 原文地址:https://www.cnblogs.com/javaweb2/p/6287053.html
Copyright © 2011-2022 走看看