• extjs 省市县级联


    Ext.define('State', {
            extend: 'Ext.data.Model',
            fields: [
                {type: 'string', name: 'nevalue'},
                {type: 'string', name: 'contents'}
            ]
        });
    
        var sheng = Ext.create('Ext.data.Store', {
            model: 'State',
            proxy: {
                type: 'ajax',
                actionMethods: {
                    read: 'POST'
                },
                url: h.url + '/t/101',
                reader: {
                    type: 'json'
                }
            },
            autoLoad: true
        });
    
        var shi = Ext.create('Ext.data.Store', {
            model: 'State',
            proxy: {
                type: 'ajax',
                actionMethods: {
                    read: 'POST'
                },
                url: h.url + '/t/102',
                reader: {
                    type: 'json'
                }
            },
            autoLoad: false
        });
    
        var xian = Ext.create('Ext.data.Store', {
            model: 'State',
            proxy: {
                type: 'ajax',
                actionMethods: {
                    read: 'POST'
                },
                url: h.url + '/t/103',
                reader: {
                    type: 'json'
                }
            },
            autoLoad: false
        });
    
    
        Ext.create("Ext.panel.Panel", {
            renderTo: document.body,
             290,
            height: 220,
            title: "城市三级联动",
            plain: true,
            margin: '30 10 0 80',
            bodyStyle: "padding: 45px 15px 15px 15px;",
            defaults: {
                autoScroll: true,
                bodyPadding: 10
            },
            items: [{
                xtype: "combo",
                name: 'sheng',
                id: 'sheng',
                fieldLabel: '选择省',
                displayField: 'contents',
                valueField: 'nevalue',
                store: sheng,
                triggerAction: 'all',
                queryMode: 'local',
                minChars: 1 ,
                editable: false,
                emptyText: '',
                blankText: '',
                listeners: {
                    select: function (combo, record, index) {
                        try {
                            var parent = Ext.getCmp('shi');
                            var parent1 = Ext.getCmp("qu");
                            parent.clearValue();
                            parent1.clearValue();
                            parent.store.load({params: {id: this.value}});
                        }
                        catch (ex) {
                            Ext.MessageBox.alert("错误", "数据加载失败。");
                        }
                    }
                }
            },
                {
                    xtype: "combo",
                    name: 'shi',
                    id: 'shi',
                    fieldLabel: '选择市',
                    displayField: 'contents',
                    valueField: 'nevalue',
                    store: shi,
                    triggerAction: 'all',
                    queryMode: 'local',
                    minChars: 1 ,
                    editable: false,
                    emptyText: '',
                    blankText: '',
                    listeners: {
                        select: function (combo, record, index) {
                            try {
                                var parent = Ext.getCmp("qu");
                                parent.clearValue();
                                parent.store.load({params: {id: this.value}});
                            }
                            catch (ex) {
                                Ext.MessageBox.alert("错误", "数据加载失败。");
                            }
                        }
                    }
                },
                {
                    xtype: "combo",
                    name: 'qu',
                    id: 'qu',
                    fieldLabel: '选择区',
                    displayField: 'contents',
                    valueField: 'nevalue',
                    store: xian,
                    triggerAction: 'all',
                    queryMode: 'local',
                    minChars: 1 ,
                    editable: false,
                    emptyText: '',
                    blankText: ''
                }
            ]
        })

  • 相关阅读:
    迅雷极速版 2020年 防止升级方法
    微PE WEPEMENU.INI CDLINUX BEINI 启动菜单
    tcping 0.39
    海康威视楼宇可视对讲解码器拨码规则计算器-安卓版
    博客园-文字互动插件
    WSL-Ubuntu 安装Xubuntu-Desktop 记录
    html css的冷门相关基础知识整理
    git hub 的冲突解决方案
    css实现垂直居中的方式
    js中BOM相关知识
  • 原文地址:https://www.cnblogs.com/lishupeng/p/10473730.html
Copyright © 2020-2023  润新知