Results 1 to 2 of 2

Thread: Loading a Tree with an xml which is getting built inside code

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    28
    Vote Rating
    0
      0  

    Default Loading a Tree with an xml which is getting built inside code

    Hello i want to load a tree with an xml that i am building in the code itself.
    So i cant give dataUrl for the loader.

    If i copy the xml generated & place in a folder & trying to load my tree with this xml then tree is getting loaded.

    But i need to load the tree with xml which is getting built in my code some where in between.

    If i need to use Xmlstore then how to get a local xml file ?

    var tree=new Ext.tree.TreePanel({
    autoScroll: true,
    rootVisible: false,
    root: new Ext.tree.AsyncTreeNode(),
    //loader: treeLoader
    //store: compnyStore
    });

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Vote Rating
    391
      0  

    Default

    That all sounds very strange. You'd probably be better off keeping your data in the browser as Ext.data.Nodes and only serializing it to XML when you absolutely have to. By keeping the data unserialized it'd make things like creating your tree much simpler.

    Using XmlStore doesn't make sense either. Stores are flat, trees are not.

    If you have an XML string then you could parse it using something like this:

    http://www.w3schools.com/xml/xml_parser.asp

    It probably doesn't make sense to write your own loader, all you need is something to convert XML to nodes then append those nodes to the tree. The method parseXml() in XmlTreeLoader shows you how.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •