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>"
		},			
//在右边显示
	"->",
相关文章
相关标签/搜索