views:

63

answers:

1

Hi All

i have a extjs TreePanel 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!

A: 

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.

Lloyd
Hey Lloyd - i love the prompt response. Any chance of a code snippet or urls that could help me out?
lance