-
14 Sep 2012 6:54 AM #1
Unanswered: Tree empty folder show root node
Unanswered: Tree empty folder show root node
Hello,
I try to show in a Tree panel a Files System.
I feed my tree with json data and it's work perfectly!
But when I have an empty folder, the tree folder (when it's deploy) show me the complete tree again.
In my server I send a json file which doesn't have children properties.
Anybody has an idea for help me?
Thanks!
David
-
16 Sep 2012 6:01 PM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
Does it help to call tree.removeAll()?
Scott.
-
16 Sep 2012 10:43 PM #3
Thanks for your answer.
But I don't know how use it. There is my code for the tree:
and there is an example of my json codeCode:Ext.onReady(function () { var treeStore = Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', url: '/File/Tree' }, root: { text: 'Files root', id: 'root', expanded: true } }); var treeUp = Ext.create('Ext.tree.Panel', { id: 'TreeFileSystem', title: 'TEST', useArrows: true, store: treeStore, rootVisible: false, renderTo: 'Tree', height: 350, listeners: { itemClick: function (view, record) { } } }); });
When I look the console of firebug, I can see, when I open the empty folder, the tree call again the store withouth attribute.console.JPGCode:[ {"cls":"first-level","expanded":"false","children":[ {"cls":"first-level","expanded":"false","children":[ {"leaf":"true","text":"..."}, {"leaf":"true","text":"..."} ],"text":"..."} ],"text":"..."}, {"text":"..."} ]
And there is a screenshot of the tree.
tree.JPG
-
19 Sep 2012 12:29 AM #4
Nobody have an idea?
EDIT: I found the solution, I build my JSON with this achitecture :
The cls and children:[] solve the problem.Code:{"path":"...","cls":"first-level","expanded":"false","children":[],"text":"..."}Last edited by dadaking; 19 Sep 2012 at 5:34 AM. Reason: I found solution


Reply With Quote