What I would like to do is:
instantiate store -> call fetch to get the data -> at a later time, run queries on this already populated store to return by a particular attribute in the store.
For instance, this will populate the store:
var store = new dojo.data.ItemFileReadStore({jsId:"cacheFirst",
url:"getCache.php?test_ids="+test_ids+"&page_id="+page_id+"&min_time=first&max_time=first&order=ASC&limit="+limit });
var processCache = function(items,request){
cache_first = items;
/* default to the first item */
cache_current = cache_first;
cache_prev = null;
updatePage();
}
store.fetch({onComplete:processCache});I then would like to at a different time do:
store.query("get all payload_time=1000000");Where the above code would simply return all the items in the store where payload_time=1000000.
I can certainly do this iteratively, but I assume the is some function that will do this for me already that I have not found. Now keep in mind that when I originally fetch the data, it is a pretty hefty SQL query, and that is why I want to return the data in one chunk, then do the filtering after. The store will be used as a cache, so as a button is clicked it will go to the next set of items, but the next set of items needs to be returned by this payload_time.
Any help will be greatly appreciated. Hopefully this is an easy one, and someone will just say, "look stupid, just use this function".
Dave

This is how I did it. I had
This is how I did it. I had a small dataset though so YMMV.
var d = { identifier: 'id',
label: 'name',
items: [ { id: 1, name: 'foobar-1', payload: 500 },
{ id: 2, name: 'foobar-2', payload: 1000 },
{ id: 3, name: 'foobar-3', payload: 1000 },
{ id: 4, name: 'foobar-4', payload: 2000 }] };
// or { url: '....' }
var store = new dojo.data.ItemFileReadStore({data: d });
store.fetch({query: {payload: 1000}, onItem: function(item) { console.log(store.getValue(item,"name")); } });
Welcome to the wild wooly world of dojo.data. Right now I'm alternating between love and hate of it. Found some really pesky bugs in it but when it works, it's wunnerful.
Thanks
I'll see if it will work reasonably well with my rather large data set.
what bugs?
Hey Seth:
Have you had a chance to file the bugs you hit in Trac or do you have a description somewhere else as a forum post?
Regards
whoops...
Sorry, forgot to include it in my previous post:
http://trac.dojotoolkit.org/ticket/6562
It's kind of esoteric as it turns out.