ExtJS4.2遇到的小問題記錄

1。在ExtJS4.2中的MVC模式下,遇到問題,在MainController中調用另外一個控制器UserController並進行初始化。遇到的問題是,會發2次請求,解決方法:java

//this.application.getController(childObject.cController).init();調用init會執行2次,應爲getController自己就會初始化
this.application.getController(childObject.cController);//直接getController便可初始化

2,先後臺數據一致問題app

//在usergrid.js中的字段必定要和,store請求後臺並返回的JSON字段名字要保持一致
columns:[
		{xtype: 'rownumberer'},
		{text:"用戶名稱",dataIndex:"userName",width:100,border: 50},
		{text:"用戶密碼",dataIndex:"password",width:100},
		{text:"性別",dataIndex:"sex",width:100,
			 xtype : 'booleancolumn',
			 trueText : "<font color=green>女</font>",
			 falseText : "<font color=red>男</font>"
		},
		{text:"電話",dataIndex:"phone",width:100},
		{text:"QQ",dataIndex:"QQ",width:100},
		{text:"Email",dataIndex:"email",width:100},
		{text:"地址",dataIndex:"addr",width:100},
		{text:"註冊時間",dataIndex:"regDate",width:100},
		{text:"註冊IP",dataIndex:"IP",width:100}
	],
//java代碼返回的JSON
                                        "{id:'"+user.getId()+"', " +
					"userName:'"+user.getUserName()+"'," +
					"password:'"+user.getPassword()+"'," +
					"sex:'"+user.isSex()+"'," +
					"phone:'"+user.getPhone()+"'," +
					"QQ:'"+user.getQQ()+"'," +
					"email:'"+user.getEmail()+"'," +
					"addr:'"+user.getAddr()+"'," +
					"regDate:'"+user.getRegDate()+"'," +
					"IP:'"+user.getIP()+"'" +
			                 "}"
//顯示男女
{text:"性別",dataIndex:"sex",width:100,
			 xtype : 'booleancolumn',
			 trueText : "<font color=green>女</font>",//若是爲true值就顯示女
			 falseText : "<font color=red>男</font>"
		},			
//在右邊顯示
	"->",
相關文章
相關標籤/搜索