No data showing in dojox.grid.DataGrid
I am using dojo 1.3 and having problems getting this dojox.grid.DataGrid working. I am sure it is my ignorance. I have been reading over the Dojo Campus examples and beleive I have right. My html looks like:
<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>
The firebug showes the data returned from the datastore as:
{identifier:"ID",items:[{"ID":"1","description":"Test Forum","title":"Test","topics":[],"commentCount":"0"}]}
When the con开发者_StackOverflow中文版tent is rendered I get the table columns listed but there is no data displayed. Am I missing something obvious?
Thanks
This one is definitely not your fault. Try changing the style on your table from:
style="width: 100%; height: 100%;"
to something like this:
style="width: 900px; height: 300px;"
I am not sure how it works inside, but I find the grid code is almost unusable because of stuff like this. Too many "features" for my liking.
I hope this works for you, it fixed it for me on version 1.2.3.
try removing the identifier, this is what I used, and it worked for me {items:[{"Title":"HelloTitle","Year":"2010","Producer":"foo"},{"Title":"HelloTitle2","Year":"2110","Producer":"f2232312164oo"}]}
I've just had the same crap happen to me in v1.7.1, and what fixed it for me was indeed giving the grid a fixed height like
#grid { height:500px !important; }
Without the !important
it didn't work because, for some obscure reason, dojo kept assigning an inline style of 0px height to that element...
精彩评论