zoukankan      html  css  js  c++  java
  • Ext treelist 动态切换TreeStore

    chooseMenu: function(_this) {
    
            //var mycomp = top.Ext.getCmp("my_comp");
            var menuTreeStore = Ext.data.StoreManager.lookup('menuTreeStore_'+_this.node);
            if (!menuTreeStore) {
                menuTreeStore = Ext.create('app.store.MenuTreeStore', {
                    pid: _this.node,
                    storeId : 'menuTreeStore_'+_this.node,
                    myid : _this.node,
                    mynode : _this.node,
                    isLoading : 0,
                    proxy: {
                        pid: _this.node,
                        id: _this.node,
                        node: _this.node
                    },
                    listeners: {
                        nodebeforeexpand: function (_this, eOpts) {
                            //设置节点id
                            if(_this.id == "root") {
                                this.mynode = _this.store.mynode;
                            } else {
                                this.mynode = _this.data.id;
                            }
                            //isLoading 是否自定义URL加载
                            this.isLoading = _this.data.isLoading;
                            //action 自定义URL
                            this.action = _this.data.action;
                        },
    
                        beforeload: function (store, operation, opts) {
                            //传参节点id作为子树的父节点
                            Ext.apply(store.proxy.extraParams, {
                                node: this.mynode
                            });
                            //isloading ==1 如果节点展开动作为加载为自定义URL, 设置proxy的url为指定的action
                            if(this.isLoading == 1) {
                                store.proxy.url = this.action;
                            } else {
                                store.proxy.url = store.originalUrl || store.proxy.url;
                            }
                        },
    
                        load: function (store, operation, opts) {
                            //加载自定义url设为0
                            this.isLoading = 0;
                        }
                    }
                })
            }
    
            var menuTree = Ext.getCmp("menuTree");
            menuTree.setStore(menuTreeStore);
        }
  • 相关阅读:
    SpringMVC中的适配器
    JVM的理解
    设计模式 特点比较
    AOP代理模式
    Spring配置补充
    MayBatis与Spring的整合
    增强和注解
    注入
    Mybatis的执行过程
    k8s认证与授权
  • 原文地址:https://www.cnblogs.com/cocoat/p/5464983.html
Copyright © 2011-2022 走看看