Ext comboBox的remote形式,联想功能实现
Ext comboBox的remote模式,联想功能实现
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"> ' + "<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"> ' + "<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(); } }