首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

main page js 一

2012-11-03 
main page js 1getcookie(../../)//获取资源文件Ext.namespace(QM.ui)var parent_node_id destro

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();
    },

热点排行