码迷,mamicode.com
首页 > 其他好文 > 详细

Ext 4.2以后版本 ComboBox 联动

时间:2015-06-08 18:57:10      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:

        //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‘
                            }]
                        }

 



 

Ext 4.2以后版本 ComboBox 联动

标签:

原文地址:http://www.cnblogs.com/Celebrator/p/4561380.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!