2018-07-30 10:34:19 
						  360 
						   0 
						   
					
					
					使用jquery操作,日常问题记录合集,容易混淆的一一记录,遇到一个更新一个. 这些问题每次都要去查一遍,记录备忘.
一.JS
1.1控制select选中
使用jquery控制select选择项问题,
先取消设置的选择项,然后再选择。
	$("#available").find("option:selected").removeAttr('selected');
	$("#available").val(data.available); 
 1.2 bootstrapValidator动态添加/删除字段验证
	if (isremove)
			$(ele).bootstrapValidator("removeField", fieldnameOrEle);
		else {
			$(ele).bootstrapValidator("addField", fieldnameOrEle, {
				validators : {
					notEmpty : {
					message : messagetext
					},
		           /*regexp:{
					regexp: /^(\d+)[A-Z]+[a-z]+[~!@#$%^&*_+()?]+$/,
				    message:'密码需要包含数字、大小写字母、 以下特殊符号~!@#$%^&*()_?,并且 长度在6-18位'
							},*/
					callback: {
					message: '密码需要包含数字、大小写字母、 以下特殊符号~!@#$%^&*()_?,并且 长度在6-18位',
					callback:testpasswd								                         
		                      }
				}
			});
		}
 function testpasswd(value, validator) {
		 
		 if(value==null||value=="")
			 return true;
		 
   	  if(!/^.*\d+.*$/.test(value))
   		  return false;
   	  if(!/^.*[A-Z]+.*$/.test(value))
   		  return false;
   	  if(!/^.*[a-z]+.*$/.test(value))
   		  return false;
   	  if(!/^.*[~!@#$%^&*_+()?]+.*$/.test(value))
   		  return false;
   	  if(!/^[\da-zA-Z~!@#$%^&*_()?]{6,18}$/.test(value))
   		  return false;
   	  
   	  return true;
	 } 
 1.3 popover弹出框被遮挡的问题
在参数中增加 container: 'body',使其在最外层弹出
     $(this).popover({
        	 container: 'body',
            placement: "left",
            content: content,
            title: "快递信息",
            html: true
        }); 
 bootstraptable 中按钮事件无响应
检查col字典是否有重复,当有重复字段时,比如有两个id字段,会导致内部js异常,不会响应按钮点击事件
function modifyAndDeleteButton(value, row, index) {
	return [ '<div class="">'
			+ '<button id = "digyi" type = "button" class = "test btn btn-info"><i class="glyphicon ">流程定义</i> </button> '
			+ '<button id = "run" type = "button" class = "btn "><i class="glyphicon ">审批流程</i> </button> '
			+ '<button id = "qs" type = "button" class = "btn "><i class="glyphicon ">签收</i> </button> '
			+ '<button id = "bl" type = "button" class = "btn "><i class="glyphicon ">办理</i> </button> '
			+ '</div>' ].join("");
}
window.PersonnelInformationEvents = {
	" click .test " : function(e, value, row, index) {
		window.open(basePath + "/activiti-app/display/dispaly.html?id="
				+ row.id + "&type=runtime");
	}, 
 
jquery validate 验证隐藏字段
默认隐藏不可见字段是不验证的,比如其他tab页的表单,
如下使用 ignore:[], 验证全部字段.
$("#carInfoForm").validate({
    	   ignore : [], //隐藏字段也验证
...
...
} 
 
二 Java
2.1gson日期格式化
 //按照 yyyy-MM-dd HH:mm:ss格式化。   
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); 
 
2.2 mongodb查询时间
db.getCollection('fms_driver_location_history').find({
    "date":{
        $lte:ISODate("2018-09-18T04:01:01Z"),
        $gte:ISODate("2018-09-17T03:50:01Z"),
        },
       "uid":"28c4f984e8934789b8bfc3e158b1aa87"
}) 
 2.3 mybatis查询list判断
mybatis判断list数据为空的时候,
报了个这个错误
invalid comparison: java.util.ArrayList and java.lang.String
处理如下:
需要 <if test="scope!=null and scope.size>0">
而不是原来普通的空判断
<if test=" code != null and code !='' ">
<select id="query" resultType="com.account.model.OauthPrivilege">
		select * from privilege
		where 1=1 
		<if test=" code != null and code !='' ">
			and code = #{code}
		</if>
		
       <if test="scope!=null and scope.size>0">
			and code in 
          <foreach collection="scope" item="ti" open="(" close=")" separator=",">
            #{ti}
          </foreach>
		</if>
	</select> 
 
2.4 nginx请求数据过大
http {  
...
 client_max_body_size 20m; 
... 
 2.5 jetty 413 请求数据过大
-Dorg.eclipse.jetty.server.Request.maxFormContentSize=-1 
 三.EDGE浏览器
edge 浏览器会自动检测符合规则的数字组合为电话号码,并加上链接的样式。
去掉这个默认的功能,在head 中加入
<meta name="format-detection" content="telephone=no">
						 2019-01-16 10:44:14 
						
					
					
							     0
							 赞
							    
							 赏
							
						
					本文基于CC BY-NC-ND 4.0 许可协议发布,作者:野生的喵喵。 固定链接: 【日常问题备忘】 转载请注明
相关文章:
		发表新的评论
	
	文章分类
文章归档
标签
					
						deb ,  
						 ,  
						蓝屏 ,  
						select ,  
						html5 ,  
						tomcat ,  
						gcc ,  
						ajax ,  
						apt-get update ,  
						选择 ,  
						js加密 ,  
						java ,  
						工作 ,  
						ocr ,  
						AngularJs ,  
						感慨 ,  
						work ,  
						click ,  
						javascript ,  
						反向代理 ,  
						ip查询 ,  
						空间查询 ,  
						word ,  
						ECS服务器 ,  
						centos ,  
						杂 ,  
						StartupWMClass ,  
						前端 ,  
						js ,  
						vmdk ,  
						感概 ,  
						select2 ,  
						virtualbox ,  
						gg代理 ,  
						share ,  
						seo ,  
						风筝 ,  
						email ,  
						ASR ,  
						转换 ,  
						cool ,  
						activiti-ui ,  
						喵小凡 ,  
						@PropertySource ,  
						ckeiditor ,  
						网站攻击 ,  
						SRILM ,  
						风景 ,  
						plugin ,  
						vdi ,  
						扩容 ,  
						chorme ,  
						阿里云 ,  
						KALDI ,  
						num ,  
						packer2 ,  
						pic ,  
						gg镜像 ,  
						win8.1 ,  
						ecs ,  
						mysql ,  
						Ubuntu ,  
						快递查询 ,  
						nginx ,  
						ubuntu ,  
						swap ,  
						maven ,  
						entropy_avail ,  
						tencent ,  
						语音识别 ,  
						prerender ,  
						xfce4 ,  
						进度条 ,  
						存储过程 ,  
						activiti ,  
						熵 ,  
						日出 ,  
						练笔 ,  
						虞美人 ,  
						nodejs ,  
						词 ,  
						demo ,  
						jquery ,  
						random ,  
						linux ,  
						cat ,  
						bootstrapValidator ,  
						angularJs ,  
						live ,  
						on ,  
						gg ,  
						雪 ,  
						婚姻 ,  
						景色 ,  
						@Autowired ,  
						pdf ,  
						emqttd ,  
						优化 ,  
						thchs30 ,  
						opencv ,  
				
			
 
			
			
								