请问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 使用C#,asp.net读取Excel文件并保存到Oracle数据库
- ¥15 C# datagridview 单元格显示进度及值
- ¥15 thinkphp6配合social login单点登录问题
- ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
- ¥15 如何在scanpy上做差异基因和通路富集?
- ¥20 关于#硬件工程#的问题,请各位专家解答!
- ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
- ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
- ¥30 截图中的mathematics程序转换成matlab
- ¥15 动力学代码报错,维度不匹配