Results 1 to 2 of 2

Thread: loading TreePanel with json data

  1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    6

    Default loading TreePanel with json data

    I have defined a TreePanel:
    <code>
    var nordicSeaTree = new Ext.tree.TreePanel({
    width: 200,
    id:'nordicSeaMarineAtlas',
    autoScroll: true,
    split: true,
    loader: new Ext.tree.TreeLoader(),
    root: new Ext.tree.AsyncTreeNode({
    text: "fish",
    expanded: true,
    children: "${species.name}"
    }),
    rootVisible: true,
    });
    </code>
    where spescies.name="[{text:\'First Level Child 1\',leaf: true}]"
    Instead of getting root: "fish" and one child element "First Level Child1" I get many children under "fish" one for each character in species.name. like so: "fish" -> "[", "{", "t","e","x","t"... and so on


    Any idea what im doing wrong? Im trying to populate the treePanel with json objects from the server. Pretty basic. But cant get it working...

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716

    Default

    Your json is invalid:

    try
    Code:
    [
        {
            "text": "FirstLevelChild1",
            "leaf": true
        }
    ]

Posting Permissions

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