Ext JS combobox 组件的各种用法


数组数据源:


var store1 = new Ext.data.ArrayStore({
			fields: ['Name', 'Code'],
			data: [['开发部', 1], ['行政部', 2], ['销售部', 3], ['质检部', 4], ['售后部', 5]]
			});


new Ext.form.ComboBox({
											id : 'infoStorePlace',
											fieldLabel :L_info_store_place,
//											fieldLabel :入库地点,
											triggerAction : 'all',
											store : store1,
											displayField : 'Name',
											valueField:'Code',
											mode : 'remote',
											handleHeight : 10,
											anchor : '95%'
										})

XML 数据源 :

<?xml version="1.0" encoding="UTF-8"?>
<Data>
  <Items>   
    <Item>
      <infoStorePlace>深圳</infoStorePlace>   
      <JP>深圳</JP>     
    </Item>
    <Item>
      <infoStorePlace>上海</infoStorePlace> 
      <JP>上海</JP>          
    </Item>
    <Item>
      <infoStorePlace>北京</infoStorePlace>  
      <JP>北京</JP>         
    </Item>
    <Item>
      <infoStorePlace>香港</infoStorePlace> 
      <JP>香港</JP>          
    </Item>   
  </Items>
</Data>

	var reagFlowcellInfoStorePlaceStore = new Ext.data.Store({
				url:'js/cBotInfoTransportState.xml',
				reader: new Ext.data.XmlReader({record:'Item'},[{name: 'infoStorePlace',mapping:'infoStorePlace'},{name:'JP',mapping:'JP'}])	
			});

new Ext.form.ComboBox({
											id : 'infoStorePlace',
											fieldLabel :L_info_store_place,
//											fieldLabel :入库地点,
											triggerAction : 'all',
											store : reagFlowcellInfoStorePlaceStore,
											displayField : 'infoStorePlace',
											valueField:'JP',
											mode : 'remote',
											handleHeight : 10,
											anchor : '95%'
										})

后台数据源:




	var incStore = new Ext.data.Store({
		proxy : new Ext.data.HttpProxy({
					url : BasicUrl + '/preOn.htm?cmd=findINClist',
					
					method : 'POST'
				}),
		reader : new Ext.data.ArrayReader({
						fields : ['laneCtrolId','libId'],
						root : "data"
					})
	});	

//从后台返回的 data 是一个对应相应 列的 数组 



new Ext.form.ComboBox({
								name : 'inLaneControl',
								fieldLabel : 'In Lane Control',
								triggerAction:'all',
								store:incStore,
								displayField:'libId',
								valueField : 'laneCtrolId',
								model : 'remote',
								value : config.record.get('inLaneControl'),
//								allowBlank:false,
//								blankText: '该项不允许为空!',
								listeners : {
									select : function(){
										//真实值 inlanecontrol id
//										var  incvalue = form.getForm().findField("inLaneControl").getValue();
										//显示值 文库ID
										var incvalue = form.getForm().findField("inLaneControl").getRawValue();
										
//										alert(incvalue + "-" + lane);
										
										//查询选择的 inlanecontrol 的文库信息 剩余量
										Ext.Ajax.request({
											url : BasicUrl + '/inLaneControlChangge.htm?cmd=findINCNum',
											method : 'POST',
											params : {
												incvalue : incvalue	
											},
											success : function(result,action){
												var incnum = Ext.util.JSON.decode(result.responseText);
												if(incnum.RemainVolume < 10){
													Ext.MessageBox.show({														
														title : '提示:',
														msg : '该文库剩余量不足10ul,是否继续使用?',
														buttons : Ext.Msg.YESNO,
														fn : function(btn){															
															if(btn == 'yes'){
																return;
															}else{																
																form.getForm().findField("inLaneControl").setValue('');
															}	
														}														
													});	
												}													
											},
											failure : function(){											
											}																						
										});
										
										
									}
									
								},
								anchor : '95%'								
								}) 




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值