easyui中表格可编辑中 datebox和datetimebox的 设置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34359363/article/details/53815437

                                     不多说 上代码!!!!!!!!!!!!!!

   {field:'date',title:'Date',width:50,align:'center',editor:
					                      {type:'datetimebox',options:{parser:function(s){
					                      
								var t = Date.parse(s);
								if (!isNaN(t)){
									return new Date(t);
								} else {
									return new Date();
								}
                              },formatter:function(date){
                            	  return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()+' '+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds();
	                                         }, }}},

两个函数:parse 把 String 转为date行 然后通过formatter对date进行格式化!

  主要是用在editor中!!!!!!!

猜你喜欢

转载自blog.csdn.net/qq_34359363/article/details/53815437
今日推荐