extjs 下拉框 多级联动

下拉框所在面板,这边有有个框子的规则和正则表达式匹配,效果图如下

代码如下:

  1. var addOfficerField = Ext.create("Ext.form.FieldSet", {  
  2.     height : 420,  
  3.     width : 350,  
  4.     border:false,  
  5.     layout : "column",  
  6. //  region: "north",  
  7.     items : [{  
  8.         xtype:'textfield',  
  9.         columnWidth :1,  
  10.         fieldLabel : '姓名<span style="color:red">*</span>',  
  11.         margin : '10 20 10 0',  
  12.         labelAlign:"right",  
  13.         blankText: '姓名不能为空',  
  14.         maxLength : 20,    
  15.         maxLengthText : '姓名长度不得大于20个字符长度',   
  16.         allowBlank: false,  
  17.         id:'addnameId',  
  18.     },{  
  19.         xtype:'textfield',  
  20.         columnWidth :1,  
  21.         fieldLabel : '出生日期<span style="color:red">*</span>',  
  22.         margin : '10 20 10 0',  
  23.         labelAlign:"right",  
  24.         blankText: '出生日期不能为空',  
  25.         allowBlank: false,  
  26.         id:'addbirthId',  
  27.     },{  
  28.         xtype:'textfield',  
  29.         columnWidth :1,  
  30.         fieldLabel : '电话<span style="color:red">*</span>',  
  31.         margin : '10 20 10 0',  
  32.         labelAlign:"right",  
  33.         blankText: '电话不能为空',  
  34.         regex:  /^(\d3,4|\d{3,4}-|\s)?\d{7,14}$/ ,  
  35.         regexText: '电话号码格式不正确',  
  36.         allowBlank: false,  
  37.          id:'addphoneId',  
  38.        },{  
  39.              xtype:'textfield',  
  40.              columnWidth :1,  
  41.              fieldLabel : '身份证<span style="color:red">*</span>',  
  42.              margin : '10 20 10 0',  
  43.              labelAlign:"right",  
  44.              blankText: '身份证不能为空',  
  45.              regex: /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/,  
  46.              regexText: '身份证号码格式不正确',  
  47.              allowBlank: false,  
  48.              id:'addcardId',  
  49.        },{  
  50.             xtype:'textfield',  
  51.             columnWidth :1,  
  52.             fieldLabel : '邮箱<span style="color:red">*</span>',  
  53.             margin : '10 20 10 0',  
  54.             labelAlign:"right",  
  55.             blankText: '邮箱不能为空',  
  56.             regex: /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/,  
  57.             regexText: '邮箱格式不正确',  
  58.             allowBlank: false,  
  59.             id:'addemailId',  
  60.        },{  
  61.              xtype:'textfield',  
  62.              columnWidth :1,  
  63.              fieldLabel : '供应商id<span style="color:red">*</span>',  
  64.              margin : '10 20 10 0',  
  65.              labelAlign:"right",  
  66.              blankText: '供应商id不能为空',  
  67.              allowBlank: false,  
  68.              id:'addsupplierId'  
  69.        },{  
  70.              xtype:'textfield',  
  71.              columnWidth :1,  
  72.              fieldLabel : '组织构架id<span style="color:red">*</span>',  
  73.              margin : '10 20 10 0',  
  74.              labelAlign:"right",  
  75.              blankText: '组织构架id不能为空',  
  76.              allowBlank: false,  
  77.              id:'addorganizationId'  
  78.        },{  
  79.              xtype:'combobox',  
  80.              editable: false,  
  81.              margin : '10 20 10 0',  
  82.              columnWidth :1,  
  83.              fieldLabel : '主站id<span style="color:red">*</span>',  
  84.              labelAlign:"right",  
  85.              store: mainStationStore,  
  86.              listeners: {  
  87.                     select : function(combo, record, index){  
  88.                             //这边是下拉联动的代码,点击这个下拉框加载下面一个下拉框的数据,这边可以用store.load(),
  89.                             //或者ajax获取数据                  
  90.                              stationStore.load({  
  91.                             //Ext.Ajax.request({  
  92.                              url: "findStation.action",  
  93.                              // async: false,  
  94.                              params: {  
  95.                                  'station.mainstationid': combo.value  
  96.                              },  
  97.                             // success : function(response, options) {  
  98.                             // stationStore.load()  
  99.                             // },  
  100.                           });  
  101.                         //var msg = mainStationGrid.getSelectModel().getSelection();  
  102.                         // var id = msg[0].data.id;  
  103.                         // stationStore.proxy.extraParams['mainstationid'] = id;  
  104.                         // stationStore.load();  
  105.                   }  
  106.              },  
  107.             triggerAction: 'all',  
  108.             displayField: "name",   
  109.             valueField: "id",   
  110.             blankText: '主站id不能为空',  
  111.             allowBlank: false,  
  112.             //mode: 'local',     
  113.             //vtype:'typeVtype',  
  114.             emptyText: "--必选,请选择--",  
  115.             id:'addmainStationId'  
  116.        },{  
  117.             xtype:'combobox',  
  118.             editable: false,  
  119.             margin : '10 20 10 0',  
  120.             columnWidth :1,  
  121.             fieldLabel : '厂站id',  
  122.             labelAlign:"right",  
  123.             store: stationStore,  
  124.             listeners: {  
  125.                 select : function(combo, record, index){  
  126.                     mainstationid = stationStore.data.items[0].data.mainstationid  
  127.                     applicationStore.load({  
  128.                             url: "findApplication.action",       
  129.                             params: {  
  130.                                     'application.mainstationid': mainstationid,  
  131.                                      'application.stationid': combo.value  
  132.                              },  
  133.                      });  
  134.                     //var mainstationid = stationStore.data.items[0].data.mainstationid  
  135.                     //applicationStore.proxy.extraParams['mainstationid'] = mainstationid;  
  136.                     //applicationStore.proxy.extraParams['stationid'] = combo.value;  
  137.                     //applicationStore.load();  
  138.                 }  
  139.             },  
  140.             triggerAction: 'all',  
  141.             displayField: "name",   
  142.             valueField: "id",   
  143.             //allowBlank: false,  
  144.             //mode: 'local',     
  145.             //vtype:'typeVtype',  
  146.             emptyText: "--可选,请选择--",  
  147.             id:'addstationId'  
  148.        },{  
  149.             xtype:'combobox',  
  150.             editable: false,  
  151.             margin : '10 20 10 0',  
  152.             columnWidth :1,  
  153.             fieldLabel : '应用id',  
  154.             labelAlign:"right",  
  155.             store: applicationStore,  
  156.             triggerAction: 'all',  
  157.             displayField: "name",   
  158.             valueField: "id",  
  159.             //blankText: '应用id不能为空',  
  160.             //allowBlank: false,  
  161.             //mode: 'local',  
  162.             //vtype:'typeVtype',  
  163.             emptyText: "--可选,请选择--",  
  164.             id:'addapplicationId'  
  165.         }]  
  166.     });  
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值