PDA

View Full Version : Simple Tree Not Working



billtricarico
1 Mar 2012, 8:24 PM
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.

aconran
1 Mar 2012, 8:33 PM
Upload a simple project archive with some test static .json data and we will take a look.

billtricarico
1 Mar 2012, 8:59 PM
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.

aconran
1 Mar 2012, 9:19 PM
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?

billtricarico
1 Mar 2012, 9:25 PM
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.

billtricarico
1 Mar 2012, 9:28 PM
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.

aconran
1 Mar 2012, 9:29 PM
I wonder if it's related to this sizing issue. I will have to investigate.
I suspect this is the case.



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.

billtricarico
1 Mar 2012, 10:33 PM
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.