Ext选中一条下拉数据实现联动

前言

前段时间因业务需要,需要加一项功能,就是选中一条数据,带动别的字段自动赋值,然后就去网上查资料,忘了从哪儿看的了,核心是这一段。原本是文本框赋值,被我改成下拉框赋值。

Ext.getcmp("txtAdd” + actionID + "stationName").setValue(Ext.getcmp("cboAddactionID +"stationorder").getSelection().data["stationInf"]);

get是选中的值,set是需要显示出来的值

代码如下:

 {
                colspan: 3,
                xtype: 'combo',
                fieldLabel: '<font color=red>*</font>'+ localForm.productType1.fieldLabel,
                name: "productType1",
                hiddenName: "productType1",
                displayField: 'productType1',
                valueField: "productType1",
                queryDelay: 1000,
                pageSize: Tool.comPageSize,  //下拉列表框的分页大小,大于0则自动创建分页栏
                allowBlank: false,
                tpl: Ext.create('Ext.XTemplate',
                    '<ul class="x-list-plain"><tpl for=".">',
                    '<li role="option" class="x-boundlist-item">{productType1}</li>',
                    '</tpl></ul>'
                ),
                listeners:{
                    select: function(combo, record, index){
                        if (record.productType1 == "null")
                                            {
                                                Ext.getCmp("repair_danwei1").setValue("无");
                                                Ext.getCmp("repair_danwei2").setValue("无");
                                            }
                                            else
                                            {
                                                Ext.getCmp("repair_danwei1").setValue(record.data.productNO1);
                                                Ext.getCmp("repair_danwei2").setValue(record.data.typeDesc);
                                            }
                    }
                },
                store: Ext.create('Ext.data.Store', {
                    pageSize: Tool.addPageSize,  //limit参数,每页显示条数,默认为25
                    autoLoad: true,
                    fields: ["ID", "productType1"],
                    proxy: {
                        type: Tool.pxyType,
                        url: Tool.baseAddr + "ProductType/GetProductType1",
                        reader: {
                            type: Tool.pxyRerType,
                            rootProperty: Tool.pxyRerRoot,
                            totalProperty: Tool.pxyRerTotal
                        }
                    }
                })
            }

  • 16
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值