自己定义json,用loadData方法把数据给树形数据(data是树形的)时要注意父ID的设置,根节点的父ID的值可以用{}设置。如下fParentID是否父ID:
var json = {"rows":[{"AP_SXSJ":"1","fName":"办公用品","fParentID":{},"rows":[{"AP_SXSJ":"2","fName":"记事本","fParentID":"1"},{"AP_SXSJ":"3","fName":"笔","fParentID":"1"}]}]}; var data = this.comp("treeData"); data.loadData(json,true); var grid= this.comp("treeGrid"); grid.refresh();
评一波