【发布时间】:2023-03-20 18:01:01
【问题描述】:
我正在从 json 字符串“http://www.ok-soft-gmbh.com/jqGrid/John.txt”创建一个 jqgrid
我写了类似于“http://www.ok-soft-gmbh.com/jqGrid/John.htm”和url的JavaScript 指向 john.txt 文件。
它给了我一张没有任何行的表格。请帮忙。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demonstration how to read simple JSON text</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/redmond/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-3.8.2/css/ui.jqgrid.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-3.8.2/js/i18n/grid.locale-en.js"></script>
<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-3.8.2/js/jquery.jqGrid.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function () {
$('#jqgrid').jqGrid({
url: 'http://www.ok-soft-gmbh.com/jqGrid/John.txt',
datatype: 'json',
colNames: ['Col1', 'Col2', 'Col3'],
colModel: [
{ name: 'col1' },
{ name: 'col2' },
{ name: 'col3' }
],
jsonReader: { repeatitems: false },
height: 'auto'
});
});
//]]>
</script>
</head>
<body>
<table id="jqgrid"><tr><td/></tr></table>
</body>
</html>
这就是我的代码...
这就是我得到的
【问题讨论】:
-
您应该发布您的确切代码。 My old demo 有效。因此,为了能够理解您的问题,您应该了解您的代码。
-
请找到我试过的代码