[Dojo-interest] dojox.grid.DataGrid + dojox.data.JsonRestStore

Kyle Spraggs theman at spiffyjr.me
Thu Sep 24 17:24:04 EDT 2009


I have a JsonRestStore with a DataGrid that I am unable to get working 
entirely. The DataGrid loads, the JSON service is queried, a response is 
returned, but the DataGrid is empty (no error, just empty).

function initGrid() {
     var store = new dojox.data.JsonRestStore({
         target: '<?=$this->url(array('controller' => 'events', 'module' 
=> 'api', 'format' => 'json'));?>'
     });

     var layout = [
         {
             field: 'id',
             width: '50%'
         },
         {
             field: 'title',
             width: '50%'
         }
     ];

     var grid = new dojox.grid.DataGrid({
         store: store,
         structure: layout
     }, document.createElement('div'));

     dojo.byId('grid').appendChild(grid.domNode);
     grid.startup();
}

<div id="grid" style="height: 300px;"></div>

Details from server:
http://pb.dev/api/events/index/format/json/?
{"request":"\/events","items":[{"id":"1","title":"World 
PvP"},{"id":"2","title":"Gather Reageants"}],"numRows":2,"identifier":"id"}

Any help would be appreciated.

-- 
Kyle Spraggs (SpiffyJr)
http://www.spiffyjr.me



More information about the Dojo-interest mailing list