View Full Version : TreeStore and json dont work together

5 Aug 2012, 9:12 AM
Heelo. I have the TreePanel:

Ext.define('LeftPanel', {
extend: 'Ext.tree.Panel',
alias: 'widget.leftpanel',

id: 'treeMainMenu',
region: 'west',
collapsible: true,
collapsed: true,
title: 'Navigation',
split: true,
width: '30%',
minWidth: 200,
minHeight: 140,
useArrows: true,
viewConfig: {
singleSelect: true,
trackOver: true,
rootVisible: false,
emptyText: 'No data',
loadingText: 'Loading tree...'


* Data source for Static Category.
Ext.define('DSStaticCategory', {
extend: 'Ext.data.TreeStore',
model: 'ModelStaticCategory',

autoLoad: false,
proxy: {
type: 'ajax',
url: baseJavaUrl,
reader: {
type: 'json',
root: 'data'
root: {
text: 'Root',
id: '0',
expanded: true

And the code:

var treeStore = new Ulmart.WebAdmin.store.DSStaticCategory();

var action = new JavaAction();
var json = Ext.JSON.encode(action);

Ext.getCmp("treeMainMenu").store = treeStore;

params: {
ulmartAction: json

The result for the store is as JSON:

{"errorMessage":null,"success":true,"loggedIn":true,"username":"forn","data":[{"text":"Why you?","id":1,"cls":"","leaf":true}],"total":1}

So why in the tree the node with text "Why you?" not displayed?

5 Aug 2012, 11:37 AM
my first guess would be:

rootVisible: false,

5 Aug 2012, 5:54 PM
The store is required at the time of creating TreePanel. Assigning store to the existing TreePanel as you do won't work.

Ext.getCmp("treeMainMenu").store = treeStore; <- this won't work