Ext.onReady(function () {
Ext.define('companyInfo', {
extend: 'Ext.data.Model',
fields: [ 'companyName','staffNum']
});
var treeStore1= Ext.create('Ext.data.TreeStore', {
model: 'companyInfo',
proxy: {
type: 'ajax',
url: 'Handler5.ashx',
// reader: 'json'
},
// nodeParam: 'orgId',nodeParam默认为“node”
//autoLoad: true,
root: {//定义本store的根节点,后台需要根的id来选择加载根的节点。根的id默认是空的
name: '根节点',
id: '-1'
}
});
Ext.create('Ext.tree.Panel', {
title: '分级加载树节点',
renderTo: Ext.getBody(),
500,
height: 350,
store: treeStore1,
//rootVisible:false,
columns: [
{ xtype:'treecolumn', text: '公司名称', dataIndex: 'companyName', sortable: true, flex: 1 },
{ text: '员工人数', dataIndex: 'staffNum', sortable: true, flex: 1 }
]
});
});