View Full Version : One last designer/data question
13 Jun 2010, 3:03 PM
What is the right way to load data manually into a Tree laid out in Extjs Designer?
Do i reset tree.loader to a new loader or is there a better/more elegant way to update the tree's data model programmatically (as opposed to loading from a a URL)
13 Jun 2010, 4:52 PM
You could use the TreeNode API and append children to your root node: http://www.extjs.com/deploy/dev/docs/?class=Ext.tree.TreeNode
The TreeLoader offers the ability to load node data only from an http endpoint, and does a "preload" of children nodes. However, loading tree data manually usually means that you use the Node API directly to append children, recursively.
There is a private method in the TreeLoader class that you can use to setup all of your data at once. First, you can create a new TreeNode that specifies "children", much like you see in the TreeLoader example: http://www.extjs.com/deploy/dev/docs/?class=Ext.tree.TreeLoader
After the node is created, you can set it as the root node for your TreePanel by calling setRootNode(). Once that's done, you can then call myTree.getLoader().doPreload(rootNode); which will setup all of your children nodes specified on your root node, recursively down the tree.
13 Jun 2010, 6:43 PM
Terrific detail, thank you again!
My game is now communicating between client and server, though there is still a lot of work to be done. Its a multi-player text-adventure construction system. Here are a few screen shots of interfaces created with extjs & ext designer..
14 Sep 2010, 3:26 AM
test my profile picture :）
Powered by vBulletin® Version 4.1.5 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.