Question

I having trouble populating a gridx widget from a JsonRest store. See my code below... test1.json contains the same info as i have specified in the data for teststore.

When i change the grid to point at the teststore var it displays the contents correctly but when i point it at the reststore variable i get a 'No items to display' message.

Anyone know what im missing?

var restStore = new   dojo.store.JsonRest({target:"http://localhost:9081/MyProj/test1.json"});


var teststore = new Store({
 data: [
 {id: "1", "description":"First Description"},
 {id: "2", "description":"Second Description"},
 {id: "3", "description":"Third Description"},
 {id: "4", "description":"Fourth Description"}
       ]
});



  grid = new Grid({
    cacheClass: Cache,
    store: restStore,
    structure: [
      {id: "description", field: 'description', width: '100%'}
    ]
  }); 

grid.startup();

No correct solution

OTHER TIPS

gridx and dojox.grid.DataGrid are not the same thing. dojox.grid.DataGrid is deprecated and only works with legacy dojo/data stores. You may use dojo/data/ObjectStore to wrap a dojo/store store with the dojo/data API:

var teststore = new ObjectStore({ objectStore: new Store({ … }) });

However, if you are starting a new project, you should use dgrid instead, which works natively with dojo/store stores.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top