// Store a ref to "this" in each item, so we can simply check if an item
// really origins form here (idea is from ItemFileReadStore, I just don't know
// how efficient the real storage use, garbage collection effort, etc. is).
dojo.forEach(data.items,function(e){
this._items.push({i:e,r:this});
},this);
varidentifier=data.identifier;
this._itemsByIdentity={};
if(identifier){
this._identifier=identifier;
for(i=0;i<this._items.length;++i){
varitem=this._items[i].i;
varidentity=item[identifier];
if(!this._itemsByIdentity[identity]){
this._itemsByIdentity[identity]=item;
}else{
thrownewError("dojo.data.QueryReadStore: The json data as specified by: ["+this.url+"] is malformed. Items within the list have identifier: ["+identifier+"]. Value collided: ["+identity+"]");
}
}
}else{
this._identifier=Number;
for(i=0;i<this._items.length;++i){
this._items[i].n=i;
}
}
// TODO actually we should do the same as dojo.data.ItemFileReadStore._getItemsFromLoadedData() to sanitize
// (does it really sanititze them) and store the data optimal. should we? for security reasons???
fetchHandler(this._items,request);
}));
xhrHandler.addErrback(function(error){
errorHandler(error,request);
});
// Generate the hash using the time in milliseconds and a randon number.
// Since Math.randon() returns something like: 0.23453463, we just remove the "0."