easyui combogrid onChanage 问题

来源:互联网 发布:淘宝账号申请及注册 编辑:程序博客网 时间:2024/05/16 19:49

easyui combogrid onChanage 输入中文的问题. 这里大家也可以讨论一下

  就是输入中文的时候就触发了. 可不可以完全输入中文在触发. 

方案: 1.延迟   -不行因为你不知道什么时候输入完成. 

           2.触发空格键触发    <输入中文的时候 -空格键.把中文输入到下拉框里>

          3.回车键触发.    <这些是方案都是避免onChanage问题

  4.失去焦点触发. 

          5.判断输入的是否为中文

最终.中英文分开查询  两个下拉框. 网友么还有其他的办法么

1.


2.

/* $(function (){
$(document.body).keypress(function (e){
if(e.keyCode==16){
if (!$(e.target).is('input,textarea')){
       $('#num')[0].focus();
   }
}

}); */


3.回车

/* $(function (){
$(document.body).keypress(function (e){
if(e.keyCode==32){
if (!$(e.target).is('input,textarea')){
       $('#num')[0].focus();
   }
}

}); */


4. //失去焦点

/* $(document).ready(function() {
$('#cityHotelLine').next().find(":text").blur(function() {
//var ss=document.getElementById("#cityHotelLine").value;
// alert($('#cityHotelLine').next().find(":text"));
alert(1);
//获取下拉的值
alert('getValue:' + $('#cityHotelLine').combogrid('getValue'));
});
}); */


5.  判断是否中文/* onChange : function(newValue, oldValue) {
countryCodeCity = newValue;
var xignzi = '中国';
if (countryCodeCity != xignzi) {
if (/^[\u4e00-\u9fa5]+$/i.test(countryCodeCity)) {
alert("输入的是中文");
str = countryCodeCity.replace(/[^\x00-\xff]/g, 'xx'); 则长度提示为4.
if (str.length >= 4) {
alert("大于4个中文");
}
} else {
alert("英文");
}
}
} */


回车:



$("#cityHotelLine").combogrid().next('span').find('input').keyup(
function() {
//showKeyName(event);
 if(event.keyCode==32){
 var countryCodeCityy=$('#cityHotelLine').combogrid('getValue');
cityHotelLineL(countryCodeCityy);
}
});
$('#cityHotelLine').combobox('textbox').keyup(function (e) {
if(e.keyCode==13){
alert("回车");

});



function showKeyName(e) {
var keyName;
switch (e.keyCode) {
case 32:
alert("空格");
break;
default:
/* keyName = e.keyCode + "[" + String.fromCharCode(e.keyCode)
+ "]"; */
alert(1);
break;
}
return keyName;
}




乱码问题. easyui combogrid  URL提交到后台乱码问题

HttpServletRequest request=ServletActionContext.getRequest();
request.setCharacterEncoding("UTF-8");
String countryCodeCity=request.getParameter("countryCodeCity");
//countryCodeCity= java.net.URLDecoder.decode(countryCodeCity,"UTF-8");

//String countryCodeCity=new String(new String(request.getParameter("countryCodeCity").getBytes("ISO-8859-1"),"UTF-8"));

注释的可以.




0 0
原创粉丝点击