1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    133
    Vote Rating
    2
    billtricarico is on a distinguished road

      0  

    Default Simple Tree Not Working

    Simple Tree Not Working


    Hello,

    For some reason I am not able to build a simple tree. I dropped in a TreePanel, wired up TreeStore (with id and text fields), and load a json tree file. That works fine in the Designer, I can see the tree nodes. When I deploy it and try it in the browser all I get is an empty tree.

    I looked at the network activity and I see the json file is being loaded. There are no errors anywhere.

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,105
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Upload a simple project archive with some test static .json data and we will take a look.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    133
    Vote Rating
    2
    billtricarico is on a distinguished road

      0  

    Default


    Here is a project archive and json tree.

    When I built this example and tested it, I got a different result. This time, I get the first node to show, but when it is expanded, the tree appears clipped.
    Attached Files

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,105
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Ah, so this is a simple Ext problem with your code but also brings up something for us to make Designer users aware of...

    The issue is that your TreePanel is being rendered without a height or width. You need to explicitly set a height and width or put the TreePanel in layout management.

    For example if you wanted the TreePanel to stretch 100% width and height of the browsers viewport you would do the following.
    - Add a Viewport as the top level component
    - Drag the TreePanel into the Viewport
    - Select Link or Move
    - Right click on MyViewport and hit mark as initial view

    The Designer specific issue is that for top level classes which do not have a height/width set we automatically stretch them to fit the entire canvas. This gives you more room to work with your component but is not accurate of the actual condition we will put in the browser.

    Make sense?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    133
    Vote Rating
    2
    billtricarico is on a distinguished road

      0  

    Default


    I do understand what you mean. I think.

    This brings up an interesting point. I have been struggling to get my multiple namespace issue working, and I run into a situation where the tree apparently loads (no errors) but nothing shows on the screen. I wonder if it's related to this sizing issue. I will have to investigate.

    Also, what is the final word on how to build a Tree/TreeStore/Model? Designer requires fields either on the TreeStore or the Model. However, I thought that fields were not explicitly needed. I thought the TreeStore would default to "id" and "text" for the tree nodes.

    Thanks.

  6. #6
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    133
    Vote Rating
    2
    billtricarico is on a distinguished road

      0  

    Default


    Also, my original layout was the following:

    Panel (for a tab) [vbox layout]
    TreePanel [flex: 1]

    I made it a vbox with the intention of adding more TreePanels stacked vertically, each with flex:1.
    What ends up happening though is that no trees will render, all I see is the title of the parent Panel.

  7. #7
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,105
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Quote Originally Posted by billtricarico View Post
    I wonder if it's related to this sizing issue. I will have to investigate.
    I suspect this is the case.

    Quote Originally Posted by billtricarico View Post
    Also, what is the final word on how to build a Tree/TreeStore/Model? Designer requires fields either on the TreeStore or the Model. However, I thought that fields were not explicitly needed. I thought the TreeStore would default to "id" and "text" for the tree nodes.
    Yea I believe we automatically add those fields if they dont exist. We will have to look into it.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  8. #8
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    133
    Vote Rating
    2
    billtricarico is on a distinguished road

      0  

    Default


    Yes that was the ticket. Adding the Viewport first and then adding everything into that. The Viewport.js that is added in the background was throwing me off. Now I have the multiple namespaces working as subfolders of the main app folder.

Thread Participants: 1