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

  • 相关阅读:
    NIO简述
    函数式编程
    ReadWriterLock读写锁
    Semaphore工具类使用
    CyclicBarrier工具类使用
    CountDownLatch工具类使用
    创建VUE+Element-UI项目
    <slot>插板使用
    Spring面试题
    实现定时任务的几种方式
  • 原文地址:https://www.cnblogs.com/javaweb2/p/6287053.html
Copyright © 2011-2022 走看看