努力吧程序员 2018-01-26 15:08 采纳率: 0%
浏览 1065
已结题

jqueryztree异步加载数据的疑问

请问jqueryztree异步加载数据要经过触发事件才加载数据吗? 还是说会自动根据每一个节点设置的参数再根据url地址去自动加载后台数据?

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-01-26 15:20
    关注

    可以自动去调用你的服务器

     var setting = {  
                    data: {  
                        simpleData: {  
                            enable: true  
                        }  
                    } ,
                    async: {
                        enable: true,
                        url:"/TestZTree/test", //post地址
                        autoParam:["id", "name", "level"], //自动传这几个参数
                        otherParam:{"otherParam":"zTreeAsyncTest"},
                        dataFilter: filter
                    }
            };  
    

    服务器根据id name level等返回json数据,ztree自动加载

     public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
            String id = request.getParameter("id");  
            String name = request.getParameter("name");  
            String level = request.getParameter("level");  
            String otherParam = request.getParameter("otherParam");  
            System.out.println(id + "|" + name + "|" + level + "|" + otherParam);  
    
            List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();  
            for(int i = 0; i < 5; i++){  
                HashMap<String,Object> hm = new HashMap<String,Object>();   //最外层,父节点             
                hm.put("id",id+i);//id属性  ,数据传递    
                hm.put("name", id+i); //name属性,显示节点名称    
                hm.put("pId", id);  
    
                list.add(hm);  
            }  
            response.getWriter().write(JSON.toJSONString(list));  
        }  
    
    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用