bryan641
7 Sep 2012, 11:02 AM
Disclaimer: I'm very new to Sencha Touch and just developing an application piece-by-piece as I'm learning the product. I have an 'Ext.List' working so that when I tap an item in the list it activates the next card (in a TabPanel), but I want the data shown in the next card to vary depending on which list item was tapped. I know which item was clicked, but what I'm having trouble with is setting the data store for the list.
basically, I'm thinking something like this in the itemTap function specified in my controller:
if (idx==0) {
this.getMyList().setStore(store1);
} else if (idx==1) {
this.getMyList().setStore(store2);
}
But how do I get a reference to the stores? I've tried the class name 'MyApp.store.MyStore1' but that's not working. Looks like setStore wants an actual object, but I can't figure out how to get it?
Does Sencha Touch not instantiate the classes declared in my applications "stores" array?
I don't think I should create an instance every time there's an itemtap. That doesn't sound efficient.
--Bryan
(Alternatively, and eventually, when my data is coming from a database, I would prefer to just alter the URL on my proxy based on the item tapped. But I thought it'd be easier to start with a separate store for each category and get things working, then change my stores to proxies with specific URLs, and eventually maybe a single store and change the proxy URL to specify certain criteria for the retrieval.)
basically, I'm thinking something like this in the itemTap function specified in my controller:
if (idx==0) {
this.getMyList().setStore(store1);
} else if (idx==1) {
this.getMyList().setStore(store2);
}
But how do I get a reference to the stores? I've tried the class name 'MyApp.store.MyStore1' but that's not working. Looks like setStore wants an actual object, but I can't figure out how to get it?
Does Sencha Touch not instantiate the classes declared in my applications "stores" array?
I don't think I should create an instance every time there's an itemtap. That doesn't sound efficient.
--Bryan
(Alternatively, and eventually, when my data is coming from a database, I would prefer to just alter the URL on my proxy based on the item tapped. But I thought it'd be easier to start with a separate store for each category and get things working, then change my stores to proxies with specific URLs, and eventually maybe a single store and change the proxy URL to specify certain criteria for the retrieval.)