天天看点

bootstrap-editable-text

bootstrap的editable当和table结合的时候,有时候数据从后台获取,然后可能会从前台设置一个填写的内容,text的就会出现undefined,

bootstrap-editable-text

可以看到异常编号那一行显示为undefined,然后查看api,其中有个emptytext·,为空的时候设置文本值,然后并不能改变undefined这个结果,

仔细分析原因,出现undefined说明这一列的数据field应该是不在传输的数据中的,只有这样,在显示的时候,才会出现undefined,所以在后台传输的数据中加了一个异常编号的字段,让它往前传,结果必然是传的空,这样我们就能给它设置emptytext,

//异常编号
	        private String exceptionNo;	    
	        public String getExceptionNo() {
			return exceptionNo;
		}

		public void setExceptionNo(String exceptionNo) {
			this.exceptionNo = exceptionNo;
		}
           

这个时候,在前台的接受代码就可以这样写

{
						field: 'exceptionNo',
						title: '异常编号',
						 align: 'center', 					
						 editable: {
								type: 'text',
								emptytext:'点我填写',
								validate: function (value)
								{		
								value = $.trim(value);
           

前台有了exceptionNo字段,

无意间看到一遍文章讲的bootstrap-editable更加清晰,http://www.cnblogs.com/landeanfen/p/5821192.html

继续阅读