• 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'
                                }]
                            }
    
    
    


  • 相关阅读:
    js检验文件格式
    java判空工具类
    $(document).ready() 是个什么函数?为什么要用它?
    Maven 手动添加jar
    java深克隆
    cors跨域详解
    常见异常类总结
    Spring事务回滚机制
    Java获取13位毫秒级时间戳
    JSON 字符串转换为 Map
  • 原文地址:https://www.cnblogs.com/Celebrator/p/4561380.html
Copyright © 2020-2023  润新知