Extjs TREE 数据格式有关问题

[{
    "text": "To Do",
    "cls": "folder",
    "expanded": true, 读文件异常,
    "children": [{
        "text": "Go jogging",
        "leaf": true,
        "checked": true
    },{
        "text": "Take a nap",
        "leaf": true,
        "checked": false
    },{
        "text": "Climb Everest",
        "leaf": true,
        "checked": false
    }]
}]


这是tree的数据格式

但是我在API中查询不道这些数据格式。。。

我现在需要知道tree JSON 所有的属性   请问怎么查询


------解决方案--------------------------------------------------------
public class TreeUtil {
public static List<CTree>getTree(List<Tree> list){
  List<CTree> tree= new ArrayList<CTree>();
  List<CTree> parent= new ArrayList<CTree>();
  List<CTree> chil =new ArrayList<CTree>();
  if(list==null){
   return tree;
  }
  for(Tree ca:list){
   if(ca.getLeaf()==0){//取出所有根节点
    CTree pt=new CTree();
    pt.setId(ca.getId());
    pt.setCid(ca.getCid());
    pt.setCls(ca.getCls());
    pt.setText(ca.getText());
    parent.add(pt);
   }else{//取出所有子节点
    CTree ch=new CTree();
    ch.setId(ca.getId());
    ch.setCid(ca.getCid());
    ch.setCls(ca.getCls());
    ch.setText(ca.getText());
    ch.setUrl(ca.getUrl());
    ch.setLeaf(ca.getLeaf()==1?true:false);
    chil.add(ch);
   }
  }
  for(CTree pr:parent){
   List<CTree> child= new ArrayList<CTree>();
   for(CTree cd:chil){
    if(pr.getCid()==cd.getCid()){
     child.add(cd);
     pr.setChildren(child);
    }
   }
   tree.add(pr);
  }

  return tree;

}
}



package com.byd.entity;
import java.io.Serializable;
@SuppressWarnings("serial")
public class Tree implements Serializable{
private String text;
private int id;
private int leaf;
private String cls;
private String url;
private int cid;//类别ID
public Tree(){

}
/**
  * @return the text
  */
public String getText() {
  return text;
}
/**
  * @param text the text to set
  */
public void setText(String text) {
  this.text = text;
}


/**
  * @return the cls
  */
public String getCls() {
  return cls;
}
/**
  * @param cls the cls to set
  */
public void setCls(String cls) {
  this.cls = cls;
}
/**
  * @return the cid
  */
public int getCid() {
  return cid;
}
/**
  * @param cid the cid to set
  */
public void setCid(int cid) {
  this.cid = cid;
}
/**
  * @return the leaf
  */
public int getLeaf() {
  return leaf;
}
/**
  * @param leaf the leaf to set
  */
public void setLeaf(int leaf) {
  this.leaf = leaf;
}
/**
  * @return the id
  */
public int getId() {
  return id;
}
/**
  * @param id the id to set
  */
public void setId(int id) {
  this.id = id;
}
/**
  * @return the url
  */
public String getUrl() {
  return url;
}
/**
  * @param url the url to set
  */
public void setUrl(String url) {
  this.url = url;
}
}
------解决方案--------------------------------------------------------
你可以从TreeNode的配置属性中看到对树节点有影响的可配置属性,其他属性,如果你增加,那就是自定义了, ORA-01722: invalid number,不会对节点的行为产生影响。
------解决方案--------------------------------------------------------
可参考:
100分 急求:extjs tree的demo(死的都行)解决方案   http://www.myexception.cn/java-web/42942.html


相关的主题文章:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值