Hithere, I'm having a strange problem where when I load a tree from a json file it goes into a loop and displays the tree as follows (in a continous loop)
-A
-A
-A
-A
My json
{
"success": true,
"results": [
{ "text": "number 1", "leaf": true },
{ "text": "number 2", "leaf": true },
{ "text": "number 3", "leaf": true },
{ "text": "number 4", "expanded": true, "children":[
{ "text": "number 4.1", "leaf": true },
{ "text": "number 4.2", "leaf": true },
{ "text": "number 4.3", "leaf": true }
]},
{ "text": "number 5", "leaf": true }
]
}
My model
Ext.define('App.model.TreeModel', {
extend:'Ext.data.Model',
fields: [
{ name: 'text', type: 'string'}
],
proxy:{
type:'ajax',
url: 'data/tree.json',
reader:{
type:'json',
root:'results'
}
}
});
Store
Ext.define('App.store.MyTreeStore', {
extend: 'Ext.data.TreeStore',
requires: 'App.model.TreeModel',
model:'App.model.TreeModel',
});
View
Ext.define('App.view.MeetingTree', {
extend:'Ext.tree.Panel',
title:'Simple Tree',
store:'MyTreeStore',
alias:'widget.meetingtree',
rootVisible:false,
height:200
});
My init file
Ext.application({
name: 'App',
autoCreateViewport: true,
models: ['TreeModel'],
stores: ['MyTreeStore'],
launch: function() {
}
});
Dont have a clue why its looping.. anyone got an idea?
Thanks in advance
finally found a solution
Remove the line
from the model
and star the json with
full json