ExtJS问题:已经从服务器端读到了json数据,但是在grid中不显示 30

//服务器端获得的数据转换为json格式json="{Employees:"+ExtHelper.getJsonFromList(employees)+"}";respo... //服务器端获得的数据转换为json格式
json = "{Employees:"+ExtHelper.getJsonFromList(employees)+"}";
response.getWriter().write(json);
//转换之后的数据是(在火狐中查看的)
{Employees:{"items":[{"employee_birth":"1993年5月22日","employee_cid":"410344199305223603","employee_dept":"1","employee_id":1,"employee_image":"123","employee_indate":"03 15 2013 12:00AM","employee_name":"linxing","employee_outstate":0,"employee_pass":"1","employee_power":0,"employee_salary":"6000","employee_sex":"女","employee_tel":"15083527791","employee_title":"管理员"},{"employee_birth":"1992年11月24日","employee_cid":"111111111111111111","employee_dept":"1","employee_id":2,"employee_image":"123","employee_indate":"03 15 2013 12:00AM","employee_name":"kef","employee_outstate":0,"employee_pass":"111111","employee_power":0,"employee_salary":"6000","employee_sex":"女","employee_tel":"15083527791","employee_title":"教师"],"results":3}}

/*在客户端读取时*/
//创建员工信息列表的数据模型
Ext.regModel('Employees',{
fields: [
{name:'employee_id'},
{name:'employee_name'},
{name:'employee_cid'},
{name:'employee_sex'},
{name:'employee_salary'},
{name:'employee_dept'},
{name:'employee_title'},
{name:'employee_indate'},
{name:'employee_birth'},
{name:'employee_outstate'},
{name:'employee_pass'},
{name:'employee_image'},
{name:'employee_tel'}]
});
//定义员工信息的数据源对象以及选择代理
var employeeStore = Ext.create('Ext.data.Store',{
autoLoad:true,
model:'Employees',
proxy:{
type:'ajax',
url:'allEmployeesAction',
reader:{
type:'json',
implicitIncludes:true,
record:'items',
root:'Employees',
idProperty: 'employee_cid',
totalProperty:'results'
}
}
});
//创建工具栏组件
var toolbar = [
{text:'新员工入职',iconCls:'add'},
{text:'员工信息修改',iconCls:'plugin'},
{text:'员工离职',iconCls:'delete'}
];
alert(employeeStore);
alert(employeeStore.items);
//创建Grid表格组件
Ext.create('Ext.grid.Panel',{
tbar:toolbar,
store:employeeStore,
selModel:new Ext.selection.CheckboxModel(),
renderTo:'emlist',
columns:[
{text:'员工编号',width:60,dataIndex:'employee_id',sortable:true},
{text:'姓名',width:80,dataIndex:'employee_name',sortable:true},
{text:'身份证号码',width:100,dataIndex:'employee_cid',sortable:true},
{text:'性别',width:60,dataIndex:'employee_sex',sortable:true},
{text:'薪资',width:80,dataIndex:'employee_salary',sortable:true},
{text:'职位',width:60,dataIndex:'employee_title',sortable:true},
{text:'入职日期',width:80,dataIndex:'employee_indate',sortable:true},
{text:'生日',width:80,dataIndex:'employee_birth',sortable:true},
{text:'在职状态',width:80,dataIndex:'employee_outstate',sortable:true},
{text:'密码',width:80,dataIndex:'employee_pass',sortable:true},
{text:'头像',width:80,dataIndex:'employee_image',sortable:true}
]

});
显示结果:

不显示具体数据
展开
 我来答
雪夜月同孤
2013-03-23 · TA获得超过281个赞
知道小有建树答主
回答量:124
采纳率:0%
帮助的人:167万
展开全部
json格式的字符串有问题。。。。返回的json字符串最后一行里面,“教师”后面少一个大括号。。这种问题下次可以尝试使用Ext.decode("json格式的字符串");来解析一下,如果报错,那就是你的字符串有问题了。。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式