我正在使用Dojo1.3,但在运行这个dojox.grid.DataGrid时遇到了问题。我敢肯定这是我的无知。我一直在阅读Dojo校园的例子,并相信我是正确的。我的html看起来像这样:
<script type="text/javascript">
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
</script>
<div dojoType="dojo.data.ItemFileWriteStore" jsId="forumsStore" url="action/forum.JsonForums"></div>
<div id="ForumsListingArea" name="ForumsListingArea">
<div id="ListOfForumsContainer" name="ListOfForumsContainer">
<table dojoType="dojox.grid.DataGrid" query="{ID:'*'}" store="forumsStore" clientSort="true" style="width: 100%; height: 100%;" id="ListOfForums" name="ListOfForums">
<thead>
<tr>
<th field="title" width="200px">Title</th>
<th field="commentCount" width="200px"># Of Posts</th>
<th field="description" width="200px">Moderators</th>
<th width="200px">Del|Config</th>
</tr>
</thead>
</table>
</div>
</div>firebug将从数据存储区返回的数据显示为:
{identifier:"ID",items:[{"ID":"1","description":"Test Forum","title":"Test","topics":[],"commentCount":"0"}]}在呈现内容时,我列出了表列,但没有显示任何数据。我是不是漏掉了什么明显的东西?
谢谢
发布于 2009-10-31 08:03:25
这绝对不是你的错。尝试将表格上的样式从以下位置更改:
style="width: 100%; height: 100%;"类似这样的东西:
style="width: 900px; height: 300px;"我不确定它是如何在内部工作的,但我发现网格代码几乎无法使用,因为这样的东西。我喜欢的“特性”太多了。
我希望这对你有用,它在1.2.3版本中为我修复了这个问题。
发布于 2010-02-18 05:45:45
试着去掉标识符,这是我用过的,对我有效{items:{"Title":"HelloTitle","Year":"2010","Producer":"foo"},{"Title":"HelloTitle2","Year":"2110","Producer":"f2232312164oo"}}
发布于 2012-02-07 22:57:30
我刚刚在v1.7.1中遇到了同样的问题,修复它的方法确实是给了网格一个固定的高度,比如
#grid { height:500px !important; }如果没有!important,它就无法工作,因为出于某种模糊的原因,dojo一直在为该元素分配0px高度的内联样式……
https://stackoverflow.com/questions/1652484
复制相似问题