-
24 Jul 2012 8:16 AM #1
Unanswered: Issue with Data stores in Sencha touch 2
Unanswered: Issue with Data stores in Sencha touch 2
I am trying to build a Tab based mobile app. I have 4 tabs Named 'Home','Call','Map','Notifications'. When i load the application i don't see the data in home tab. When i tap on other tab and comeback to home tab i can see data. This will work if i put a dummy tab as first tab( in my case i added 'Welcome' as first tab). I also noticed that when 'Home' is the first tab store is not loaded. The item array for 'Home' store is empty.
When i tap on Maps and Notifications tab i don't see the data loaded.
I have attached the code i am using.The tab application i developed is based on tab example i found in sencha examples.
Can anyone please look into the code and point to me where i am doing wrong.
Note: i have removed the sdk and resource folder as the size of the attachment is very big when including these two folder.We can copy sdk and resource folder by creating/existing project using sencha app create from command prompt
-
26 Jul 2012 3:33 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
How are you trying to load the data?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
26 Jul 2012 7:03 AM #3
-
26 Jul 2012 11:11 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
Ok, in an event listener? In init?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
26 Jul 2012 10:27 PM #5
I had some similar problem, with setting up view elements programmatically from a store.
My solution was to listen to the load event in the store and refresh the view after the store was loaded:
Code:Ext.define('MyApp.store.Slides', { .... listeners: { 'load' : { fn : function(store,records,options) { // store finished loading, now lets refresh my view: Ext.getCmp('detailview').refreshPool(); }, scope : this } }*/
And your store should have autoLoad: true, so that it loads at app start :-)
-
28 Jul 2012 12:20 AM #6
I have the following in my Init of controller
init: function () {
this.callParent(arguments);
Ext.getStore('Home').load();
}
also i have added the following in "launch" and "onActivate" in controller
var storeData = Ext.getStore('Home').load();
var container = this.getHomeTabContainer();
if (storeData != null) {
var record = storeData.getAt(0);
if (record != null) {
var tpl = container.down('#pnlHome').getTpl(); //container.getTpl();
var htmlstr = tpl.apply(record.data);
container.setHtml(htmlstr);
}
}
still it does not work.
attached is my latest code
-
3 Aug 2012 11:10 PM #7
-
4 Aug 2012 4:03 AM #8
I once had a similar problem and my first workaround was to programmatically
setActiveItem(1);
setActiveItem(0);
So changing the views programmatically (without any1 seeing it, because it changes back immediately) and so achieve to refresh the view and see the refreshed data in the view :-)
Because I also figured out that my view didn't load and found out that it would only load when I change views (change tabs or whatever)...
Not a good solution but at least its a solution :-)
Another solution would be to try to sync the store so that the view, that has the store attached will also get synced I guess.
-
4 Aug 2012 10:43 PM #9
for time being i have added another static ( which does not read from data store ) tab . Is this a bug in sencha touch2 or is this the expected behaviour?


Reply With Quote