View Full Version : Tree empty folder show root node

14 Sep 2012, 6:54 AM

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?



16 Sep 2012, 6:01 PM
Does it help to call tree.removeAll()?


16 Sep 2012, 10:43 PM
Thanks for your answer.

But I don't know how use it. There is my code for the tree:

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) {

and there is an example of my json code


When I look the console of firebug, I can see, when I open the empty folder, the tree call again the store withouth attribute.38728
And there is a screenshot of the tree.

19 Sep 2012, 12:29 AM
Nobody have an idea?

EDIT: I found the solution, I build my JSON with this achitecture :


The cls and children:[] solve the problem.