开发者

extjs: load tree via json returned from Ext.data.JsonStore

开发者 https://www.devze.com 2023-01-18 14:49 出处:网络
i have a extjs T开发者_运维问答reePanel that i need to load using json data (cross-domain call) returned from my Ext.data.JsonStore call. That works perfectly. I just cant find a way to use the return

i have a extjs T开发者_运维问答reePanel that i need to load using json data (cross-domain call) returned from my Ext.data.JsonStore call. That works perfectly. I just cant find a way to use the returned jsonStore to load the treepanel. Any ideas? I am real desperado.

Thanks everyone!

code snippet:

var store = new Ext.data.JsonStore({
    root: 'topics',
    totalProperty: 'totalCount',
    idProperty: 'threadid',
    remoteSort: true,

    fields: [
        'title', 'forumtitle', 'forumid', 'author',
        {name: 'replycount', type: 'int'},
        {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
        'lastposter', 'excerpt'
    ],

    proxy: new Ext.data.ScriptTagProxy({
        url: 'http://other.domain/test.aspx'
    })
});

// Now i need to use that store to load the tree...

var Tree = Ext.tree;
var tree = new Tree.TreePanel({
  useArrows: true,
  autoScroll: true,
  animate: true,
  enableDD: true,
  containerScroll: true,
  border: false,
  loader: new Tree.TreeLoader({ dataUrl: '????' })
  //.....
});

Help!


You would have to add a load listener to the store and manually add tree nodes from the loaded data into the tree, the tree does not support stores directly, remember that tree's are hierarchical and stores and pretty flat.

0

精彩评论

暂无评论...
验证码 换一张
取 消