I have an application that has 3 level of data depth:
- list of presentations
- presentation detail
- presentation slides
Right now when user came to the app he’s presented with list loaded from JSONP store. He click on one item and the callback function receives the record. It pushes it into new view – the detail and displays it. User can disclose presentation slides from there – data record is passed from detail again.
Problem is when user refreshes the page or came from URL. If he came to url like /presentations/slides/1, he wants to see the slides for presentation id:1. Problem is that as long as he wasn’t at the list, data was not loaded and because it was not loaded, it was not passed to the detail and the detail didn’t pass it along to the slides view. So I have no data.
But I still have the ID! Comming from the PHP’s Zend Framework, I would call something like: this.store.find(1), but I can’t find any way to do this.
How do I load something from the store based on it’s record.data.id?
To add more, store.load() seems to work asyncronously, so when I do:
store.load();
store.each(function(rec){console.log(rec);});
It wouldn’t work with JSONP store, because the data is not loaded yet. But when I use Chrome Debuger and pause the execution to let the data load, it works 🙁
You are correct the load is asyncronously so all you have to do is use the callback function of the store. You can find an example here How to get data from extjs 4 store