ext combox级联例子

 var ds_num = new Ext.data.Store({
    url : 'findAllFeedNum.action',
    reader : new Ext.data.JsonReader(
    {totalProperty : 'totalProperty',root : 'root'},
    [
        {name : 'material_name', type : 'string'},
        {name : 'material_desc', type : 'string'}
    ])
  });

  var ds_feed = new Ext.data.Store({
    url : 'findByFeedNum.action',
    reader : new Ext.data.JsonReader(
    {totalProperty : 'totalProperty',root : 'root'},
    [
        {name : 'material_name', type : 'string'},
        {name : 'material_desc', type : 'string'},
        {name : 'material_type', type : 'string'},
        {name : 'department', type : 'string'}
    ])
  });
 {
            xtype : 'fieldset',
            title : '物料添加',
            collapsible: true,
            width :375,
            items : [
            {
             width : 219,
             xtype : 'combo',
             fieldLabel : '料号',
             id : 'stock_feedNum',
             name : 'stock.feedNum',
             hiddenName : 'stock.feedNum',
             valueField : 'material_name',
             minChars : 1,
             typeAhead: true,
             forceSelection: true,
             displayField : 'material_name',
             mode : 'remote',
             queryParam : 'query',
             store : ds_num,
             selectOnFocus : true,
             editable : true,
             allowBlank : false,
             triggerAction : 'all',
             loadingText : '加载中...',
             emptyText : '料号',
             listeners : { // 获得下拉文本内容,解决id,value都要的情况
             'select' : function(combo, record, index) {
                    Ext.getCmp('stock_depict').reset();
                    Ext.getCmp('add_unit').reset();
                    ds_feed.baseParams.feedNum = Ext.getCmp('stock_feedNum').getValue();
                    ds_feed.reload();
                    getMatDescByMat(Ext.getCmp('stock_depict'),record.data.material_name);
                    this.ownerCt.ownerCt.form.findField('stock.feedNum').setValue(record.data.material_name);
                 }
               }
        },{
            width : 219,
            xtype : 'combo',
            fieldLabel : '描述',
            id : 'stock_depict',
            name : 'stock.depict',
            hiddenName : 'stock.depict',
            valueField : 'material_desc',
            typeAhead: true,
            forceSelection: true,
            displayField : 'material_desc',
            mode : 'remote',
            store : ds_feed,
            editable : true,
            allowBlank : false,
            triggerAction : 'all',
            loadingText : '加载中...',
            emptyText : '描述',
            listeners : { // 获得下拉文本内容,解决id,value都要的情况
            'select' : function(combo, record, index) {
                      this.ownerCt.ownerCt.form.findField('stock.depict').setValue(record.data.material_desc);
                },
            'beforequery' : function(queryEvent) {
             if (!Ext.getCmp('stock_feedNum').getValue()) {
                    queryEvent.cancel = true;
                    }
                 }
               }
        }

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值