Results 1 to 5 of 5

Thread: TreePanel not converting children to childNodes

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2010
    Posts
    35
    Answers
    3
    Vote Rating
    1
      0  

    Default TreePanel not converting children to childNodes

    I feel as though I'm just missing something completely obvious here, but I'm having trouble getting some data to display in a TreePanel. After struggling to get it to work, I decided it must be something with my data, so I copied and pasted the example data from the API docs (http://docs.sencha.com/extjs/6.0/6.0...Ext.tree.Panel) below, but am still having trouble.

    I've got the following

    Code:
    {
            xtype:'treepanel',
            reference:'helpTopicTree',
            title:'Help Topics',
            flex:1,
            root: {
                expanded: true,
                text:'root',
                children: [
                    { text: 'detention', leaf: true },
                    { text: 'homework', expanded: true, children: [
                        { text: 'book report', leaf: true },
                        { text: 'algebra', leaf: true}
                    ] },
                    { text: 'buy lottery tickets', leaf: true }
                ]
            }
        }
    But all that renders is the root.

    When I look at rootNode in console, I see 0 childNodes, but I do see the child configs under data object. (See image). I feel as though I should see 3 childNodes, since there are 3 objects in the children array of data.

    Any help is greatly appreciated.
    root-node-issue.PNG

  2. #2
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,984
    Answers
    725
    Vote Rating
    933
      0  

    Default

    You copied something different to the example. The example creates a store, your code doesn't.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2010
    Posts
    35
    Answers
    3
    Vote Rating
    1
      0  

    Default

    Thanks for the quick reply Evan. I did consider that, but I've also tried copying from the NodeInterface docs (http://docs.sencha.com/extjs/6.0/6.0....NodeInterface), where no store is used, and I run into the same issue.

    There is the small difference in that the example has the data defined as variable first, and that variable is passed to the treepanel constructor, as opposed to doing it inline, but I can't imagine that's the issue here.

    Code:
    {
            xtype:'treepanel',        
            reference:'helpTopicTree',
            title:'Help Topics',
            flex:1,
            root: {
                expanded: true,
                children: [{
                    text: "Leaf node (<i>no folder/arrow icon</i>)",
                    leaf: true,
                    qtitle: 'Sample Tip Title',
                    qtip: 'Tip body'
                }, {
                    text: "Parent node expanded",
                    expanded: true,
                    children: [{
                        text: "Expanded leaf node 1",
                        leaf: true
                    }, {
                        text: "Expanded leaf node 2",
                        leaf: true
                    }]
                }, {
                    text: "Parent node collapsed",
                    children: [{
                        text: "Collapsed leaf node 1",
                        leaf: true
                    }, {
                        text: "Collapsed leaf node 2",
                        leaf: true
                    }]
           }]
    }
    results in
    root-node-issue-2.PNG

  4. #4
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    753
    Answers
    9
    Vote Rating
    59
      0  

    Default

    same problem here![COLOR=#025B80 !important]childNodes is empty array[/COLOR]

    Wemerson Januario
    Blog: http://wemersonjanuario.com.br
    Contrate-me/Hire me on: https://www.upwork.com/fl/wemersonjanuario
    From: Goiânia, GO, Brazil
    Sencha Consultant and Web Developer

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

  5. #5
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    753
    Answers
    9
    Vote Rating
    59
      0  

    Default

    I solved my problem extending my model from Ext.data.TreeModel
    Wemerson Januario
    Blog: http://wemersonjanuario.com.br
    Contrate-me/Hire me on: https://www.upwork.com/fl/wemersonjanuario
    From: Goiânia, GO, Brazil
    Sencha Consultant and Web Developer

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

Similar Threads

  1. Replies: 1
    Last Post: 3 May 2013, 10:16 AM
  2. Avoid children load when children allready loaded in TreePanel
    By zopinto in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 12 Aug 2010, 7:52 AM
  3. Replies: 10
    Last Post: 5 Aug 2010, 5:30 AM
  4. Replies: 1
    Last Post: 12 Aug 2009, 5:30 PM
  5. Checking ChildNodes in TreePanel
    By Dev_User in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 5 May 2008, 2:18 PM

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
  •