easyui的树

<div class="iteye-blog-content-contain" style="font-size: 14px"></div>

 //easyui 的树需要拼接成json格式,

  1. [{
  2. "id":1,
  3. "text":"Folder1",
  4. "iconCls":"icon-save",
  5. "children":[{
  6. "text":"File1",
  7. "checked":true
  8. },{
  9. "text":"Books",
  10. "state":"open",
  11. "attributes":{
  12. "url":"/demo/book/abc",
  13. "price":100
  14. },
  15. "children":[{
  16. "text":"PhotoShop",
  17. "checked":true
  18. },{
  19. "id": 8,
  20. "text":"Sub Bookds",
  21. "state":"closed"
  22. }]
  23. }]
  24. },{
  25. "text":"Languages",
  26. "state":"closed",
  27. "children":[{
  28. "text":"Java"
  29. },{
  30. "text":"C#"
  31. }]
  32. }]   
  33. //	public  void main(String[] args) {
    //	
    //		JSONArray ja=new JSONArray();
    //		JSONObject jo = new JSONObject();
    //		JSONObject jo2 = new JSONObject();
    //		BaseDao dao=getDao();
    //		try{
    //			List<OrgModel> list=dao.selectForList("org.getOrgByPid",model);
    //			List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
    //			OrgModel m;
    //			for(int i=0; i<list.size();i++){
    //				m = list.get(i);
    //				jo2= new JSONObject();
    //				jo2.put("pid",);
    //				jo2.put("text", "parent"+i);
    //				for (int j=0; j<list2.size(); j++) {
    //					jo = new JSONObject();
    //					jo.put("id", j);
    //					jo.put("text", "Folder"+j);
    //					ja.put(jo);
    //				}
    //				jo2.put("childern", ja.toString());
    //				System.out.println(jo2.toString());
    //				}
    //		} catch (Exception e) {
    //			e.printStackTrace();
    //		}
    //	}
  34. //获取youthWeb端的归属地
    	public void getYouthListWeb(){
    		JSONArray ja=new JSONArray();//json数组
    		JSONObject jo;//json对象
    		BaseDao dao=getDao();
    		try {
    			model.setPid("1");
    			List<OrgModel> list=dao.selectForList("org.getListWebByPid",model);
    			OrgModel m;
    			 jo=new JSONObject();
    			 jo.put("id","");
    			 jo.put("text","");
    			 ja.put(jo);
    			 JSONObject jo1=new JSONObject();
    			 jo1.put("id","");
    			 jo1.put("text","");
    			 ja.put(jo1);
    			 JSONObject jo2=new JSONObject();
    			 jo2.put("id","");
    			 jo2.put("text","");
    			 ja.put(jo2);
    			 System.out.println(ja.toString());
    			for (int i=0; i<list.size();i++) {
    				m = list.get(i);
    				jo = new JSONObject();
    				jo.put("id", m.getOrgCode());
    				jo.put("text", m.getOrgName());
    				ja.put(jo);
    			}
    			System.out.println("下拉框"+ja.toString());
    			this.doResponse(ja.toString());
    		} catch (Exception e) {
    			logger.error("获取失败:", e);
    			this.doResponse("");
    		}
    	}
    	
     
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值