PDA

View Full Version : Tree Panel never stops loading...



worthlutz
9 Mar 2012, 8:02 AM
I'm trying to use a tree panel. It loads and is visible but the "loading..." mask nevers goes away.

I tried it with Extjs 4, Beta 2 and Beta 3.

Can any one see my problem? Or replicate it? I'm stumped.

Thanks,
Worth
---------------------------------------------------------

Ext.application({
name: 'TreeView',
appFolder: 'app',

controllers: [ 'Main' ],

launch: function () {
Ext.create( 'Ext.container.Viewport',
{ layout: 'fit',
padding: 15,
items: [
{ xtype: 'treepanel',
store: 'ViewList',
rootVisible: false,
width: 300,
height: 550
}
]
}
);
}
});

Ext.define( 'TreeView.store.ViewList',
{ extend: 'Ext.data.TreeStore',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'data/ViewTree.json'
}
}
);


Ext.define( 'TreeView.controller.Main',
{ extend: 'Ext.app.Controller',
stores: [ 'ViewList' ],
init: function() {
console.log('starting Main init');
this.control(
{ 'viewport > treepanel': {
render: this.ar
}
}
);
},

ar: function () {
console.log('after render in Main.js');
}
}
);
data/ViewTree.json

[ { text: 'Viewport',
expanded: true,
children: [
{ text: 'imageblock',
leaf: true
},
{ text: 'titleblock',
leaf: true
},
{ text: 'workblock (card)',
expanded: true,
children: [
{ text: 'search',
leaf: true
}
]
}
]
}
]

worthlutz
9 Mar 2012, 8:07 AM
Must be a 4.1.0 bug. Went and got version 4.0.7-gpl and it works there.

Worth

tobiu
9 Mar 2012, 8:12 AM
take a look at: http://jsonlint.com/
your json is not valid.

also take a look at:
http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/tree/reorder.html
and the sources there.

there is a root specified on the store.

the json with a working format can be found here:
http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/tree/get-nodes.php

worthlutz
9 Mar 2012, 8:49 AM
The JSON format problem makes no difference in my example. Something is throwing an uncaught exception.

It still works in 4.0.7 and NOT in 4.1.0 Beta 2 & 3 with corrected JSON.

I'll continue looking at the other example you pointed out and see what else I might have missed.

Thanks,
Worth

Corrected json which passes JSLint:

[ { "text": "Viewport",
"expanded": true,
"children": [
{ "text": "imageblock",
"leaf": true
},
{ "text": "titleblock",
"leaf": true
},
{ "text": "workblock (card)",
"expanded": true,
"children": [
{ "text": "search",
"expanded": true,
"children": [
{ "text": "instructions",
"leaf": true
},
{ "text": "searchoptions",
"expanded": true,
"children": [
{ "text": "combo",
"leaf": true
},
{ "text": "combo",
"leaf": true
},
{ "text": "combo",
"leaf": true
}
]
},
{ "text": "panel(card)",
"expanded": true,
"children": [
{ "text": "searchcard",
"leaf": true
},
{ "text": "searchcard",
"leaf": true
},
{ "text": "searchcard",
"leaf": true
},
{ "text": "searchcard",
"leaf": true
},
{ "text": "searchcard",
"leaf": true
}
]
},
{ "text": "toolbar",
"expanded": true,
"children": [
{ "text": "button[search]",
"leaf": true
},
{ "text": "button[reset]",
"leaf": true
}
]
}
]
}
]
}
]
}
]

mankz
10 Mar 2012, 12:32 AM
Remove autoLoad : true for the TreeStore? Not sure it's required...

incutonez
11 Mar 2012, 8:11 AM
Using your code in 4.0.7 doesn't produce any problems.