PDA

View Full Version : Populating Tree with XML File



TheLord
1 Dec 2008, 2:30 AM
Hi there,
got some problems filling a Tree Store by xml using the XmlReader.



Tree tree = new Tree();

RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,"xml/readEPG.xml");
final HttpProxy proxy = new HttpProxy(builder);

ModelType type = new ModelType();
type.root = "demo";
type.recordName = "item";
type.addField("title");
type.addField("starttime");

// need a loader, proxy, and reader
XmlReader reader = new XmlReader(type);
final BaseTreeLoader loader = new BaseTreeLoader(proxy, reader);

final TreeStore<ModelData> store = new TreeStore<ModelData>(loader);

TreeBinder binder = new TreeBinder(tree, store);
binder.setAutoLoad(true);
binder.setDisplayProperty("title");

I tried this with a ListStore and a ListStoreLoader, it works: store.getCount() > 0
But what do I have to change to fill the TreeStore? (store.getChildCount() = 0 :()

TheLord
1 Dec 2008, 3:09 PM
I think I need just a little tip... should be easy, shoudln't it? :)

jmhwhite2001
16 Dec 2008, 8:40 AM
Look at thread:

http://extjs.com/forum/showthread.php?t=54722

Instead of using the HTTPProxy, use the Request and put your code snippet in the "onRequestReceived" method. that might get you going...I'm working the same issues.