Hello,
I am new to Dojo and I am trying to create an ItemFileReadStore to feed a grid. Using the following markup, I get what I am looking for when the server reads the item parameter from the url.
<div dojoType="dojo.data.ItemFileReadStore" jsId="jsonStore" url="http://mysite.com&item=1234">
</div>
</div>
If I need to pass a different item number to the server dynamically, how would I go about doing that? I tried creating the Store programmatically like this, but the code throws an error on the last statement:
function getItem(){
return 1234; //hard code for now
}
var _url = "https://mysite.com&item="+getItem();
var jsonStore = new dojo.data.ItemFileReadStore({
url: _url
});
return 1234; //hard code for now
}
var _url = "https://mysite.com&item="+getItem();
var jsonStore = new dojo.data.ItemFileReadStore({
url: _url
});
<div dojoType="dojox.grid.data.DojoData" jsId="model" rowsPerPage="5" store="jsonStore" clientSort="true" query="{ memberItem: '*' }">
</div>
<div id="grid" dojoType="dojox.Grid" model="model" structure="layout">
</div>
</div>
<div id="grid" dojoType="dojox.Grid" model="model" structure="layout">
</div>
I also tried wrapping the instantiation of the Store in dojo.addOnLoad(function... to no avail.
How should I go about this?
Thanks,
playalpha
p.s- I hope this is the right board, since the class I seem to be having trouble with lives under dojo.

I moved this post over from dojo core
No suggestions in dojo core forum. Is this a better place for this question?
Grid is showing now, but getting "this.store is undefined"
// a grid view is a group of columns.
var view1 = {
cells: [[{
name: 'Assembly Member',
//width: "*",
field: 'memberItem'
}, {
name: 'Standard Quantity',
field: 'standardQuantity'
}, {
name: 'Quantity Picked',
field: 'pickedQuantity'
}, {
name: 'Current Variance',
field: 'currentVariance'
}, {
name: 'Quantity On Hand',
field: 'quantityOnHand'
}]]
};
// a grid layout is an array of views.
var layout = [view1];
console.debug(layout);
function getAssembly(){
return "sample_JSON2.txt";
}
var jsonStore = new dojo.data.ItemFileReadStore({
jsId: jsonStore,
url: getAssembly()
});
var model = new dojox.grid.data.DojoData({
jsId: model,
rowsPerPage: 5,
store: jsonStore,
clientSort: true,
query: {
memberItem: '*'
}
});
var parentContainer = dojo.byId("manifestDiv");
var gridContainer = parentContainer.appendChild(document.createElement("div"));
var grid = new dojox.Grid({
id: 'grid',
query: { memberItem: '*' },
store: jsonStore,
structure: layout,
model: model
},
gridContainer);
grid.startup();
});
bump
bump
Look at this article
Hi,
please look at the article "Refreshing a data store", in order to understand, why the ItemFileReadStore doesn't work this way. There are other datastores available for such purposes (for example the QueryReadStore).
Marcus
------------
http://www.dojotoolkit-forum.de
Thanks for the reply, starting to think this forum was deserted
Hi Marcus,
Thanks for the reply it set me off on a new path to explore.
Also I am having trouble discovering the parameters that the object argument to the constructor takes. In general, is it all of the fields listed under "Properties" in the API docs (fetch, lastRequestHash, requestMethod, and url)?
Does it have a superclass that I am missing, or are these the only arguments?
for example:
fetch: abc,
lastRequestHash: def,
requestMethod: GET,
url: 'mysite.com/gridbackend'
}
var foo=new dojox.data.QueryReadStore(args);
I guess this is more of a general API documentation question, but I am finding it a little confusing.
Thanks,
-Clinton