zoukankan      html  css  js  c++  java
  • Ext 4.2以后版本 ComboBox 联动

            //combox树
            ComboTree: function (upDep, empStore) {
                var com = Ext.create('Ext.ux.desktop.ComboTree', {
                    margin: '0 0 5 5',
                    labelWidth: 60,
                    //rootText: 'text',
                    emptyText: '请选择部门...',
                    flex: 3,
                    rootId: 'id',
                    expanded: true,
                    storeUrl: '/data/personMatter/orgHandler.ashx?Action=tree',
                    editable: false,
                    name: 'depname',
                    value: upDep,
                    id: 'CommonUp_Add_From',
                    selectMode: 'all',
                    treeHeight: 300,
                    listeners: {
                        select: function (Combox, record, index) {//联动效果
                            var city = Ext.getCmp('emplerId');
                            city.clearValue();
                            city.store.removeAll();
                            depId = record.data.id;
                            empStore.load({
                                params: {
                                    action: 'empInDep', depId: record.data.id
                                }
                            });
                        }
                    }
                });
                return com;
            },

    form:
                var empStore= Ext.create('Ext.data.Store', {
                    fields: ['id', 'name'],
                    proxy: {
                        type: 'ajax',
                        url: '/data/CommonHandlers/ComboBoxHandler.ashx',
                        reader: {
                            type: 'json',
                            root: 'items'
                        }
                    }
                });
    
    
    
     
    {
                                fieldLabel: '业务员',
                                labelWidth: 60,
                                margin: '0 0 5 20',
                                xtype: 'fieldcontainer',
                                combineErrors: true,
                                defaultType: 'textfield',
                                defaults: {
                                    hideLabel: 'true'
                                },
                                layout: 'hbox',
                                flex: 1,
                                items: [CusManage.CustomerList.ComboTree('', empStore),
                                {
                                    emptyText: '请选择员工...',
                                    flex: 2,
                                    selectOnFocus: true,
                                    xtype: 'combobox',
                                    name: 'empler',
                                    margins: '0 0 0 6',
                                    valueField: 'id',
                                    store:empStore,
                                    displayField: 'name',
                                    queryMode: 'local',  //4.2以前版本为model,一定看清,否自抓狂
                                    id:'emplerId'
                                }]
                            }
    
    
    


  • 相关阅读:
    PHP通过日志来发现问题
    php环境重启
    排行榜的实现
    git相关使用技巧和问题
    lua State加载部分库
    c++ 解析json
    查看某个进程允许打开的最大文件描述符
    glog安装与使用
    ubuntu update-alternatives
    gcc安装多个版本
  • 原文地址:https://www.cnblogs.com/Celebrator/p/4561380.html
Copyright © 2011-2022 走看看