请问如何构建ext树的json数据?

String sql = "select cc_h as id ,cc_mc as text from cc ";
List list =getSqlList(sql);
JSONArray jsonObject = JSONArray.fromObject(list);
json = jsonObject.toString();


出来的数 据是
[{"text":"aa","id":"2"},{"text":"bb","id":"3"},{"text":"cc","id":"4"},
{"text":"dd","id":"5"}]


都 只是根的子节点,没有根据 cc 的parent_cc_h 构建子节点

  • neptune - 1年前

    var tree = new Ext.tree.TreePanel({ loader: new Ext.tree.TreeLoader({ dataUrl: '10-01.txt'  }), root: new Ext.tree.AsyncTreeNode({ id: '0', text: '根'  }), autoHeight: true, renderTo: 'tree'  });
    
    
    [
        {text:'01',qtip:'01',children:[
            {text:'01-01',qtip:'01-01',leaf:true},
            {text:'01-02',qtip:'01-02',leaf:true},
            {text:'01-03',qtip:'01-03',leaf:true}
        ]},
        {text:'02',qtip:'02',children:[
            {text:'02-01',qtip:'02-01',leaf:true},
            {text:'02-02',qtip:'02-02',leaf:true},
            {text:'02-03',qtip:'02-03',leaf:true}
        ]}
    ]