刚学easyui,使用datagrid数据不显示,页面空白

CN_Anyoo 2012-01-02 03:44:39
不报错,页面时完全空白的。。

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="/MerchantInfo/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
href="/MerchantInfo/easyui/themes/default/easyui.css">
<script type="text/javascript"
src="/MerchantInfo/easyui/jquery-1.4.4.min.js"></script>
<script type="text/javascript"
src="/MerchantInfo/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
$('#feedback').datagrid({
title : "用户反馈 - 所有",
width : "auto",
striped : true,
singleSelect : true,
loadMsg : "正在加载,请稍等...",
url : "feedback_data.json",
pagination : true,
rownumbers : true,
pageList : [ 5, 10, 15, 20 ],
pageSize : 10,
idField:"id",
columns:[[
{title:"发送人",field:"user",width:"180",align:"center"} ,
{title:"反馈内容",field:"title",width:"300",align:"center"},
{title:"时间",field:"sendTime",width:"300",align:"center"}
]]
});
</script>
</head>
<body>
<table id="feedback"></table>
</body>
</html>


这是我的json数据,手写死的

{
"total":10,
"rows":[
{"id":"001","user":"ok","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40"},
{"id":"002","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40"},
{"id":"003","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40"},
{"id":"004","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40"},
{"id":"005","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40"},
{"id":"006","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40"},
{"id":"007","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40"},
{"id":"008","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40"},
{"id":"009","user":"zs","title":"这款软件我非常满意","sendTime":"2012年1月1日 15:40"},
{"id":"010","user":"zs","title":"I think so good","sendTime":"2012年1月1日 15:40"}
]
}

...全文
4899 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Kax熊熊 2014-09-02
  • 打赏
  • 举报
回复
请在前面加上 :$(document).ready(function() {............这里加上你的那代码});
csucaicai 2014-07-07
  • 打赏
  • 举报
回复
你这明显没有初始化,不过都两年了,你还不结贴,至于么,40分
无为之士 2013-08-01
  • 打赏
  • 举报
回复
你少写了点东西 <script type="text/javascript"> $(function() { $('#feedback').datagrid( { url : 'feedback_data.json', title : "用户反馈 - 所有", width : "auto", striped : true, singleSelect : true, loadMsg : "正在加载,请稍等...", url : "feedback_data.json", pagination : true, rownumbers : true, pageList : [ 5, 10, 15, 20 ], pageSize : 10, idField:"id", columns:[[ {title:"发送人",field:"user",width:"180",align:"center"} , {title:"反馈内容",field:"title",width:"300",align:"center"}, {title:"时间",field:"sendTime",width:"300",align:"center"} ]] }); }); </script> 这样才对
tony4geek 2013-08-01
  • 打赏
  • 举报
回复
你在加载成功的函数里看看有没有数据,看看结果 。
u011485589 2013-08-01
  • 打赏
  • 举报
回复
对不起错了,表情错了,没明白
u011485589 2013-08-01
  • 打赏
  • 举报
回复
gaisia 2012-02-07
  • 打赏
  • 举报
回复
我也遇到,待解
CN_Anyoo 2012-01-02
  • 打赏
  • 举报
回复
{title:"发送人",field:"user",width:"180",align:"center"} ,

这个逗号是正常显示的,复制过来就跑到那里了,在代码里不是。
还有个问题,我在创建tab的时候,为什么加上这个参数selected:true
就可以显示json数据呢,不加上就光只有datagrid,没用数据。

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧