Note that there are some explanatory texts on larger screens.

plurals
  1. POQueryReadStore loads JSON into DataGrid, but JsonRestStore does not (from the same source)
    primarykey
    data
    text
    <p>I'm building a Dojo DataGrid from JSON data provided by my REST interface. The DataGrid loads the data fine using a QueryReadStore, but doesn't seem to work with the same same data piped into a JsonRestStore.</p> <p>I'm using the following Dojo libs with Dojo 1.4.1:</p> <pre><code>dojo.require("dojox.data.JsonRestStore"); dojo.require("dojox.grid.DataGrid"); dojo.require("dojox.data.QueryReadStore"); dojo.require("dojo.parser"); </code></pre> <p>I declare my stores in the following manner:</p> <pre><code>var storeJRS = new dojox.data.JsonRestStore({target:"api/collaborations.php/1"}); var storeQRS = new dojox.data.QueryReadStore({url:"api/collaborations.php/1", requestMethod:"get"}); </code></pre> <p>I create my grid layout like this:</p> <pre><code>var gridLayout = [ new dojox.grid.cells.RowIndex({ name: "Row #", width: 5, styles: "text-align: left;" }), { name: "Name", field: "name", styles: "text-align:right;", width:20 }, { name: "Description", field: "description", width:30 } ]; </code></pre> <p>I create my DataGrid as follows:<br> <code>&lt;div dojoType="dojox.grid.DataGrid" jsid="grid2" store="storeQRS" structure="gridLayout" style="height:500px; width:1000px;"&gt;&lt;/div&gt;</code></p> <p>The above works, but if I use QueryReadStore as my store, the grid is created with the headers (Name, Description), but it isn't populated with any rows:<br> <code>&lt;div dojoType="dojox.grid.DataGrid" jsid="grid3" store="storeQRS" structure="gridLayout" style="height:500px; width:1000px;"&gt;&lt;/div&gt;</code></p> <p>Using FireBug, I can see that QueryReadStore is getting my JSON data from my REST interface. It looks like the following:</p> <pre><code>{"numRows":6,"items":[{"name":"My Super Cool Collab","description":"This is for all the super cool people in the super cool group","id":1},{"name":"My Other Super Cool","description":"This is for all the other super cool people","id":3},{"name":"This is another coll","description":"This is just some other collab","id":4},{"name":"some new collab","description":"this is a new collab","id":5},{"name":"yet another new coll","description":"uh huh","id":6},{"name":"asdf","description":"asdf","id":7}]} </code></pre> <p>Any ideas? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload