ext grid 显示不出数据

我是用ext+jsp弄得person.do访问后后台输出的Json:{totalCount:7,rows:[{"id":"1","name1":"天","title":"... 我是用ext+jsp弄得person.do访问后后台输出的Json:{totalCount:7,rows:[{"id":"1","name1":"天","title":"asd","content":"ghj","time1":"2009-01-04 00:00:00.0"},{"id":"2","name1":"一天","title":"计划主题","content":"计划内容","time1":"2008-01-06 00:00:00.0"},{"id":"3","name1":"天","title":"123","content":"456","time1":"2009-01-04 00:00:00.0"},{"id":"4","name1":"一天","title":"789","content":"123","time1":"2009-01-04 00:00:00.0"},{"id":"5","name1":"一天","title":"asda","content":"fffff","time1":"2009-10-11 00:00:00.0"}]} 页面代码:<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>index</title> <link rel="stylesheet" type="text/css" href="./ext/resources/css/ext-all.css" /> <link rel="stylesheet" type="text/css" href="./ext/shared/examples.css" /> <script type="text/javascript" src="./ext/ext-base.js"></script> <script type="text/javascript" src="./ext/ext-all.js"></script> <script> Ext.onReady(function(){ var sm = new Ext.grid.CheckboxSelectionModel(); var cm = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), sm, {header:"编号",dataIndex:"id"}, {header:"几天",dataIndex:"name1"}, {header:"标题",dataIndex:"title"}, {header:"内容",dataIndex:"content"}, {header:"时间",dataIndex:"time1"} ]); cm.defaultSortable = true; var ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:"person.do"}), reader: new Ext.data.JsonReader({ totalProperty: "totalCount", root: "rows" }, [ {name: "id",mapping:"id"}, {name:"name1",mapping:"name1"}, {name:"title",mapping:"title"}, {name:"content",mapping:"content"}, {name:"time1",mapping:"time1"} ]) }); var grid = new Ext.grid.GridPanel({ el: "grid", ds: ds, cm: cm, sm: sm, title: "员工登记", bbar: new Ext.PagingToolbar({ pageSize: 5, store: ds, displayInfo: true, displayMsg: "显示第 {0} 条到 {1} 条记录,一共 {2} 条", emptyMsg: "没有记录" }) }); ds.load({params:{start:0,limit:5}}); grid.render();}) </script> </head> <body> <div id="grid"></div> </body></html> 实体类属性private Integer id; private String name1; private String title; private String content; private Timestamp time1; 运行后页面只现实列,没有数据 急需解决 谢谢。!!! 展开
 我来答
cjh_mr
2011-11-07
知道答主
回答量:5
采纳率:0%
帮助的人:3535
展开全部
代码好凌乱,首先,你确定一下你通过person.do拦截后后台有没有返回正确的JSON串,如果有,那就是你前台的问题,如果没有,那先确保有正确的JSON串到前台。
给一个可以出数据的例子给你:
new Ext.grid.GridPanel({
store : new Ext.data.Store({
autoDestroy : true,
autoLoad : true,
url : 'opinion_list.action',
baseParams : {
loadStore :true,
start :0,
limit :20,
adSearch :adSearch
},
storeId : 'storeId',
reader : new Ext.data.JsonReader({
root : 'data',
idProperty : 'id',
totalProperty : 'total',
fields : [
{name:'disposeDate'}
,{name:'userName'}
,{name:'userGroup'}
,{name:'opinion'}
,{name:'upDispose'}
,{name:'nextDispose'}
]
})
}),
columns: [
{header: "处理时间", width: 115, sortable: true, dataIndex: 'disposeDate'},
{header: "人员名称", width: 115, sortable: true,dataIndex: 'userName'},
{header: "用户组", width: 115, sortable: true, dataIndex: 'userGroup'},
{header: "意见", width: 129, sortable: true, dataIndex: 'opinion'},
{header: "上一处理用户", width: 115, sortable: true, dataIndex: 'upDispose'},
{header: "下一处理用户", width: 115, sortable: true, dataIndex: 'nextDispose'}
],
width:720,
height:430,
frame:true,
title:'历史列表'
})
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
Exploiter_zds
2011-11-01
知道答主
回答量:11
采纳率:0%
帮助的人:6.9万
展开全部
找到Ext包中examples包下的grid中的列子看下,应该很简单的。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式