Hi I am trying to load data for tree panel through json and
I'm referring this link. tree panel is showing properly except there is no data.
here is my code
Edit updated code as Objectone suggested
Ext.require([
'Ext.tree.*',
'Ext.data.*',
'Ext.tip.*'
]);
Ext.onReady(function() {
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'treeJson.json'
},
root: {
expanded: true
},
folderSort: true,
sorters: [{
property: 'text',
direction: 'ASC'
}]
});
var tree = Ext.create('Ext.tree.Panel', {
store: store,
renderTo: 'tree-div',
height: 300,
width: 250,
title: 'Files',
useArrows: true,
dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'Expand All',
handler: function(){
tree.expandAll();
}
}, {
text: 'Collapse All',
handler: function(){
tree.collapseAll();
}
}]
}]
});
console.log(store.getRootNode());
});
here is json
[
{
"text": "To Do",
"cls": "folder",
"expanded": true,
"children": [
{
"text": "Go jogging",
"leaf": true
},
{
"text": "Take a nap",
"leaf": true
},
{
"text": "Climb Everest",
"leaf": true
}
]
}
]
Firebug is showing no error,
Any idea what I'm doing wrong?
Thanks in advance