前端之家收集整理的这篇文章主要介绍了
dojo grid中无法显示数据的问题,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_
403_0@最近开始学习dojo,虽然说都是客户端的
代码,但是还是遇到了些问题。
@H_
403_0@在学习grid表格的时候,数据一直
显示不出来,而且IE等浏览器也没有
提示什么
错误。
@H_
403_0@研究好了好长时间,终于知道问题的原因了,现在写下来,以免初学者走弯路。
@H_
403_0@[html源码]
<html>
<head>
<style type="text/css">
@import "./dojoroot/dijit/themes/tundra/tundra.css";
@import "./dojoroot/dojo/resources/dojo.css";
@import "./dojoroot/dojox/grid/_grid/tundraGrid.css";
</style>
<script type="text/javascript" src="./dojoroot/dojo/dojo.js"
djConfig="parSEOnLoad:true"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojox.grid.Grid");
</script>
<script type="text/javascript">
var jsonData= {
items: [ { row: 1,index: 'one' },{ row: 2,index: 'two' },{ row: 3,index: 'three' },{ row: 4,index: 'four' },{ row: 5,index: 'five' },{ row: 6,index: 'six'}]
};
</script>
</head>
<body class="tundra">
<div dojoType="dojo.data.ItemFileReadStore" jsId="jsStore" data="jsonData"></div>
<table dojoType="dojox.grid.DataGrid" store="jsStore" clientSort="false" id="grid1" jsId="grid1" singleClickEdit="true">
<thead>
<tr>
<th field="row" editable="false">id</th>
<th field="index" editable="true">index</th>
</tr>
</thead>
</table>
</body>
</html>
[问题现象]
html在IE9中显示如下
不知道为什么数据就是显示不出来,而且没有提示错误。
[解决方法]
经过研究IE的设置,我把IE中的script debug开启了,默认状态是关闭的。
然后再次运行网页,发现下面的错误
@H_403_0@原来是因为xmlHttpRequest对象不能使用的原因,经过调查发现在windows中需要运行下面的命令来注册xmlHttpRequest
@H_403_0@开始>>运行: regsvr32 msxml3.dll
@H_403_0@运行之后,IE重启。问题就解决了