views:

703

answers:

2

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 content is rendered I get the table columns listed but there is no data displayed. Am I missing something obvious?

Thanks

A: 

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.

tommyjr
Are you suggesting I am setting myself up for many more problems? It would be easy enough to whip out the list of row myself.
Mark
The declarative field bindings add quite a bit of value, so I wouldn't say it is not worth the headaches. I guess it depends on the nature of the data you are showing and how grid-like you need to be. Another problem: the grid cells have to be exactly the same height. In most grids, this is the case (one line of text). But for my use case, I had one row that was a paragraph of text, each a different size. This causes some strange behavior when you scroll down a large list. It is not easy to debug.
tommyjr
A: 

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"}]}

alec