-
10 Sep 2012 1:42 PM #1
Unanswered: MVC Controller ref store or pollingprovider
Unanswered: MVC Controller ref store or pollingprovider
Hi,
I have tried various permutations, but can not figure out how to ref either a store or pollingprovider in my app.Controller. I even tried to autoCreate these components within the controller but without success. Creating them in the app.Launch works just fine, but then I can't "ref" them and hook their events. Any help would be welcome, tia.
Code:Ext.define('MyApp.controller.ctrlMain', { extend: 'Ext.app.Controller', config: { refs: { sightTab: 'tabbar button[iconCls=search]', tweetTab: 'tabbar button[iconCls=chat3]', sightstore: '#storeSightings', // which I added both as id and storeId to my store pollProvider: '#poll1', // which I added both as id and itemId to my pollingprovider }, control: { pollProvider: { data: 'pollData' }, sightstore: { load: 'sightingsLoaded' } } }, pollData: function() { // This never fires alert('poll'); }, sightingsLoaded: function() { // This never fires alert('load'); } });Production: Ext4/Touch2
"Real programmers use C: >copy con > myprog.exe"
-
12 Sep 2012 4:59 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
refs are only for components. A store or PollingProvider are not components, they are just classes.
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.
-
12 Sep 2012 5:35 AM #3
Thanks much, explains it.
Does not make sense though. Strictly speaking using the MVC paradigm, all Control should after all be manageable/implementable in the controller(s).
Surely it would not be such a big jump from being able to ref UI components as well as any other types of non-UI controls like stores, direct providers, etc. One could even limit the Controller to resolve using ComponentQuery like now, and then just for the fun of it, check if the ref is not contained in the Application object. All the rest works the same, how events are hooked up, how callbacks are used, etc. The only limitation currently that the refs are synthetically limited to components only, instead of all Ext objects in the application.
Bit silly to use a MVC methodology and then have to split your Control functionality between UI and non-UI events - makes everything messy again.
Now one have to create one half the components in the app.js, the other half in views/controllers; handle the one half of the events here, and the rest there. All whilst all the events usually end up influencing the UI in some way.
Just my 2 cents.Production: Ext4/Touch2
"Real programmers use C: >copy con > myprog.exe"
-
1 Dec 2012 4:53 AM #4
So what is best practise to handle a store-event in controller?
-
1 Dec 2012 6:56 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
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.


Reply With Quote