EXt gridpanel 显示数据
me.columns = [ {
text : '用户名',
dataIndex : 'userName',
flex : 1,
editor:{
allowBlank:false
}
}, {
text : '电子邮件',
dataIndex : 'email',
flex : 1,
editor:{
allowBlank:false,
vtype:'email'
}
}, {
text : '角色',
dataIndex : 'roles',
flex : 1,
editor:{
xtype: 'combo',
store:'Roles',
multiSelect:true,
allowBlank:false,
editable:false,
emptyText:"请选择角色",
forceSelection:true
}
}, {
xtype : "datecolumn",
text : '创建时间',
dataIndex : 'createdDateTime',
format : "Y-m-d H:i:s",
width : 150
}, {
xtype : "datecolumn",
text : '最后登录时间',
dataIndex : 'lastLoginDateTime',
format : "Y-m-d H:i:s",
width : 150
}, {
xtype : 'checkcolumn',
dataIndex : "isApproved",
text : "允许登录",
winth : 150,
editor: {
xtype: 'checkbox',
cls:'x-grid-checkheader-editor'
}
} ];
我的json数据有值:
{"total":2,"data":[{"createdDateTime":"2013-10-31T00:00:00","email":"11newuser@email.com","id":6,"isApproved":"true","lastLoginDateTime":"2013-11-01T00:00:00","password":"123","roles":"系統管理者","userName":"admin"},{"createdDateTime":"2013-10-30T00:00:00","email":"newuser@email.com","id":8,"isApproved":"true","lastLoginDateTime":"2013-11-01T00:00:00","password":"456","roles":"普通用戶","userName":"user"}],"success":true}
但是前台不显示页面。
如果json的数据是:
[{"createdDateTime":"2013-10-31T00:00:00","email":"11newuser@email.com","id":6,"isApproved":"true","lastLoginDateTime":"2013-11-01T00:00:00","password":"123","roles":"系統管理者","userName":"admin"},{"createdDateTime":"2013-10-30T00:00:00","email":"newuser@email.com","id":8,"isApproved":"true","lastLoginDateTime":"2013-11-01T00:00:00","password":"456","roles":"普通用戶","userName":"user"}]
就能正常显示。