Extjs4.2.1 - Ошибка загрузки json в древовидную панель
Я создаю панель дерева и я и создаюstore
лайк
var store = Ext.create('Ext.data.TreeStore', {
autoload: false,
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'results'
}
}
});
мой сервер печати JSON выглядит
{ "results":
[
{ id : '1' , text : '1', expanded: true,
children :[
{ id : '5' , text : '5', leaf:true},
{ id : '6' , text : '6', leaf:true}
]
},
{ id : '2' , text : '2', leaf:true},
{ id : '3' , text : '3', leaf:true},
{ id : '4' , text : '4', leaf:true},
{ id : '7' , text : '7', leaf:true},
{ id : '8' , text : '8', leaf:true},
{ id : '9' , text : '9', leaf:true},
{ id : '10' , text : '10', expanded: true,
children :[
{ id : '11' , text : '11', leaf:true},
{ id : '12' , text : '12', leaf:true}
]
}
]
}
Но когда я запускаю свой код, я вижу firebug, и он всегда запускаетсяGET http://localhost/example/data.php...
никогда не останавливайся :(
и мое дерево добавляется так много
Как это исправить спасибо
редактировать
В действительности я определяю свою панель дерева с псевдонимом и использую ее какxtype
Но я создаю новый пример и получаю ту же проблему. Вот мой js
var store = Ext.create('Ext.data.TreeStore', {
autoload: false,
proxy: {
type: 'ajax',
url: 'data.php',
reader: {
type: 'json',
root: 'results'
}
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody()
});
А вот мойdata.php
echo "
{
'success': true,
'variable': 100,
'results':
[
{ id : '1' , text : '1', expanded: true,
children :[
{ id : '5' , text : '5', leaf:true},
{ id : '6' , text : '6', leaf:true}
]
},
{ id : '2' , text : '2', leaf:true},
{ id : '3' , text : '3', leaf:true},
{ id : '4' , text : '4', leaf:true},
{ id : '7' , text : '7', leaf:true},
{ id : '8' , text : '8', leaf:true},
{ id : '9' , text : '9', leaf:true},
{ id : '10' , text : '10', expanded: true,
children :[
{ id : '11' , text : '11', leaf:true},
{ id : '12' , text : '12', leaf:true}
]
}
]
}";