I am trying to connect a dojo 1.7 objectStore or itemFileWriteStore to a grid but I;m not sure what I'm doing wrong.
When I run my code below using the ItemFileWriteStore, I get the grid headers but I dont see my data. When I use ObjectStore, the grid isnt there.
What am I doing wrong?
UPDATE: just noticed that the store.data attribute is empty. Must mean the format of of my "dataBucket" could be wrong?
require(['dojo/on'
,'dojo/ready'
,'dojo/dom'
,"dojo/data/ObjectStore"
,"dojo/store/Memory"
,"dojox/grid/DataGrid"
,"dojo/data/ItemFileWriteStore"
],
function (on,ready,dom,objStore,memStore,grid,itemStore){
ready(function(){
var dataBucket = {//idProperty: 'ID', //for object store?
identifer: 'ID', //for itemStore
items : [
{ID : '100', col2 : 'Ciao Ciao'},
{ID : '200', col2 : 'Hello'}
]};
var stuff = new itemStore({data : dataBucket});
//var stuff = new objStore({store : dataBucket});
//var stuff = new memStore({data : dataBucket});
var layout = [[
{'name':'ID','field' : 'ID','width' : '100px'},
{'name':'Stuff','field' : 'col2','width' : '100px'}
]];
var myGrid = new grid({
id: 'grid',
store: stuff,
structure: layout,
rowSelector: '20px'},
document.createElement('div')
);
dojo.byId("bottomPane").appendChild(myGrid.domNode);
myGrid.startup(); })
})
}
)
turns out the store hadnt been populated with data correctly. It constructed a store without indicating the data passed in was in the incorrect format