`
zhcl321
  • 浏览: 26497 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

Ext comboBox的remote模式,联想功能实现

    博客分类:
  • Ext
阅读更多
			function showUserGroupComBox(){
				if(userGroupComBox!=null){
					userGroupComBox.destroy();
				}
				userGroupComBox = new Ext.form.ComboBox({
					id : "userGroupComBox",
					name : 'userGroupComBox',
					triggerAction : 'all',
					displayField : 'value',
					valueField : 'value',
					mode : 'remote',
					// mode : 'local',
					width : 180,
					loadingText : "please waitting",
					editable : true,
					resizable : true,
					typeAhead : false,
					minChars : 1,
					enableKeyEvents: true,
					hideTrigger : (Ext.getCmp("userTypeComBox").value == "MSISDN_USER" || Ext.getCmp("userTypeComBox").value == "IMSI_USER")?true:false,
					store : (proVersion == is7X8X) ? [["", ""]] : childStore,
					listeners : {
						// 验证用户输入的用户群是否正确
						blur : function(combo, record, index) {
							if(!queryFlag){
								Ext.get("msg").dom.innerHTML = '<img src=\"'
									+ basePath
									+ '/theme/default/images/cue.png">&nbsp;' + "<span style='color:red;line-height:24px;' ext:qtip='" + tag_userNotSupportSearch + "'>" 
								+ ps.string.cutString(tag_userNotSupportSearch, ggsnbarTitleMaxLength,true) + "</span>";
								return queryFlag;
							}							
							var comTypeValue=Ext.getCmp("userTypeComBox").value;
							var currInputValue = combo.value;

							if (combo.value == "") {
								currMSISDN = "";								
								Ext.ps.commonCmp.UserGroup.setTipInfo(comTypeValue);
								return;
							} else {
								currMSISDN = "";
								// 判断输入的用户格式是否符合
								if (Ext.ps.commonCmp.UserGroup
										.checkInput(currInputValue) == false) {
									return;
								} 
								/*else {
									queryMSISDN(currInputValue);
								}*/
							}
						},
						keyup: function(combo, evt) {
						    firstTime = false;
						},
						select:function (combo, record, index){
							if(!queryFlag){
								Ext.get("msg").dom.innerHTML = '<img src=\"'
									+ basePath
									+ '/theme/default/images/cue.png">&nbsp;' + "<span style='color:red;line-height:24px;' ext:qtip='" + tag_userNotSupportSearch + "'>" 
								+ ps.string.cutString(tag_userNotSupportSearch, ggsnbarTitleMaxLength,true) + "</span>";
							}
							firstTime = true;
							return queryFlag;
						},
						beforeselect: function (combo, record, index){
                            if (record.data.value == "<div style=\"background-color:#ffffff;cursor:default;\"\>...</div>") {
                                // 如果选择 ... 则不更改选当前选择的值
                                var originValue = combo.value;
                                combo.setValue(originValue);
                                combo.collapse();
                                combo.selectText(originValue.length, originValue.length);
                                firstTime = true;
                                return false;
                            }
                            return true;
                        }
					}
				});
				if(userGroupPanel!=null){
					userGroupPanel.insert(2,userGroupComBox);
					userGroupPanel.doLayout();
				}
			}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics