ajax请求的js代码的路径是写到了节点node的属性里,在初始化树节点的时候就已经动态的写好了
一个子模块的示例 用户管理
useradmin.js
// 用户管理模块
Ext.extend(Ext.Panel, {
constructor: function(config) {
// 表格模型
var cm = new Ext.grid.ColumnModel([
{
id: 'username',
header: "姓名",
dataIndex: 'username',
width: 100
},{
id: 'email',
header: "电子邮件",
dataIndex: 'email',
width: 100
},{
id: 'createdate',
header: "注册时间",
dataIndex: 'createdate',
width: 100
},{
id: 'updatedate',
header: "修改时间",
dataIndex: 'updatedate',
width: 100
}]);
//console.log(basePath+'campaign/id/review');
// 数据来源储存
var user_store = new Ext.data.Store({
url: basePath+'users/ajaxserv',
reader: new Ext.data.JsonReader({
root: 'users',
totalProperty: 'totalCount',
id: 'id'
}, [
'username', 'email', 'createdate', 'updatedate'
])
});
cm.defaultSortable = true;
user_store.load();
config = Ext.apply({
id: 'm_useradmin',
title: '用户管理',
autoScroll: true,
closable:true ,
items:[
new Ext.grid.GridPanel({
store: user_store,
cm: cm,
stripeRows: true,
height: 350,
//width: 800,
autoWidth : true,
loadMask: {msg:'正在加载数据,请稍后'},
title: '用户列表' ,
tbar: [{ text: '添加', iconCls: 'new-item', tooltip: { title:'添加用户', text:'在此系统中注册一个新的用户'} }],
bbar: new Ext.PagingToolbar({
pageSize: 25,
store: user_store,
displayInfo: true,
displayMsg: '显示记录 {0} - {1} of {2}',
emptyMsg: "没有任何记录"
})
})
]
}, config);
module.superclass.constructor.call(this, config);
}
});
来自:http://hi.baidu.com/wastorode/blog/item/68a073cb1aab9a2ff9dc617b.html