天天看點

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

繼續閱讀