main page js 1

getcookie("../../");//获取资源文件
Ext.namespace("QM.ui");
var parent_node_id = "destroy_2302";
QM.ui.AccordinTreePanel = Ext.extend(Ext.Panel, {
/**
* @cfg(url) 发送请求的地址
*/
/**
* @cfg(root) json数组的根字符串
*/
margins: '5 0 5 5',
split: true,
width: 175,
extraCls:'ccc',
initComponent: function(){
Ext.apply(this, {
layout: 'accordion',
region: 'west'
})
QM.ui.AccordinTreePanel.superclass.initComponent.call(this);
this.addEvents( /**
* @event itemclick 树结点被点击时触发 参数:node 当前结点对象,record 当前结点对应record对象
*/
'click', /**
* @event afterload 菜单项加载完毕后触发
*/
'afterload');
if (!this.store) {
this.store = new Ext.data.JsonStore({
url: this.url,
root: this.root,
fields: ['code', 'name', 'parentcode', 'iconCls', 'href']
});
}
this.store.load({
callback: this.loadTrees,
scope: this
});
},
layoutConfig:{
//titleCollapse: false,
animate: true,

fill : false
},

loadTrees: function(records, o, s){
var pnodes,trees = [],tree;
this.store.sort('code');
for (var i = 0; i < records.length; i++) {
var record = records[i];
if (!record.get('parentcode')) {
tree = this.creatTreeConfig(record);
trees.push(tree);
pnodes = [];
pnodes.push(tree.root);
}
else {
var next_record = records[i + 1];
var isLeaf = !next_record || next_record.get('parentcode') != record.get('code');
this.addTreeNode(pnodes, record, isLeaf);
}
}
Ext.each(trees,function(tree){
this.add(tree);
},this);
this.fireEvent('afterload', this);
this.mon(this.el, 'click', this.onClick, this);
this.doLayout();
this.store.destroy();
},
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值