ExtJs-TreeStore AJAX代理未向服务器发送请求或TreeStore未加载
Ext js TreeStore未加载ExtJs-TreeStore AJAX代理未向服务器发送请求或TreeStore未加载,extjs,Extjs,Ext js TreeStore未加载 Ext.ns('App'); Ext.onReady(function() { Ext.QuickTips.init(); App.PPPExplorer.init(); }); App.PPPExplorer = { // Initialize application init : function(serverCfg) { this.PPP = this.createPPP(); }, createPPP :
Ext.ns('App');
Ext.onReady(function() {
Ext.QuickTips.init();
App.PPPExplorer.init();
});
App.PPPExplorer = {
// Initialize application
init : function(serverCfg) {
this.PPP = this.createPPP();
},
createPPP : function() {
// Set up a model to use in our Store
Ext.define('Summary', {
extend: 'Ext.data.Model',
fields: [
{name: 'pid', type: 'string'}
]
});
var myStore = Ext.create('Ext.data.TreeStore', {
model: 'Summary',
storeId:'myStore',
proxy: {
type : 'ajax',
method: 'GET',
url: '/Explorer.do?method=getPPP&search=true',
reader: {
type: 'json'
},
root: {
pid: 'src',
text:'test',
expanded: true
},
},
autoLoad: true
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: myStore,
// rootVisible: true,
renderTo: 'Explorer',
columns: [{
xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Reference',
flex: 2,
sortable: true,
dataIndex: 'pid',
locked: true
}]
});
}
}
我使用的是ExtJS4.2版本
我在上面的代码中使用了treeStore、treePanel,但不知何故代理调用并没有发送到服务器。控制台中没有错误消息
提前感谢根定义应该是树顶内部定义如下(现在在代理声明中): })) 这样你的代码就可以工作了
var myStore = Ext.create('Ext.data.TreeStore', {
model: 'Summary',
storeId: 'myStore',
proxy: {
type: 'ajax',
method: 'GET',
url: '/Explorer.do?method=getPPP&search=true',
reader: {
type: 'json'
}
},
autoLoad: true,
root: {
pid: 'src',
text: 'test',
expanded: true
}