views:

7

answers:

1

Hi All,

I've been trying to get a Tree to work using my xml. But i'm like stuck without any clue as how to move ahead. I've tried quite a few things, which i've tried and would mention here.

Background: I've been trying to create a tree from XML which looks like:

<root>
  <hierlabel>A_Level0</hierlabel>
      <hierlabel>A_Level1</hierlabel>
            <hierlabel>A_Level2</hierlabel>
  <hierlabel>B_Level0</hierlabel>
       <hierlabel>B_Level1</hierlabel>
   :
   :
</root> 

So i expect a tree like :
   |-A_Level0
   |  |- A_Level1
   |      |- A_Level2
   |-B_Level0
      |- B_Level1   

Problem: In the examples that i see, the 'ForestStoreModel' that is being constructed requires a 'childrenAttrs' property. But in this case there is no such field which defines the parent/child relationship, instead its just the 'hierarchy' which defines such a relation.

Code:

var store = new dojox.data.XmlStore({
                jsId:'mystore',
                url:'http://localhost/someplace/somewhere?getxml=true
            });

            var treeModel = new dijit.tree.ForestStoreModel({
                store: store,
                rootItem:'hierlabel',
                label:'hierlabel',
                query: {
                },
                rootLabel: "MyLabels",
                deep:'true',
            });

            new dijit.Tree({
                model: treeModel

            },  "treeOne");

I've even tried overriding the getChildren function but no luck! If thats the only correct way, more pointers on that would help!

Any help will be highly appreciated. Thanks.

A: 

Hi,

I just found the answer to my question. Adding it here, might help others looking for it!

Following is a very good example of the same.

http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/data/demos/demo_MultiStores.html

Thanks!

Abhishek