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


相關的主題文章:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章