PDA

View Full Version : How to build a MVC app and Controller callback function not firing



rubyrain
7 Nov 2011, 10:31 AM
While I was following this guide, http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-3/, I ran into few problems and was unable to solve them.

First of all, I downloaded Pandora app and made it work with dynamic loading.
Then, I tried to build the app and it stops with an error. (I successfully built the example in Getting Started)
Can somebody point me to the right direction on how to build an MVC app?

Also, there is a glitch in controller (still on Pandora example). In the following codes, onStationsLoad functions doesn't run after stationsStore is loaded.


onLaunch: function() {
var stationsStore = this.getStationsStore();
stationsStore.load({
callback: this.onStationsLoad,
scope: this
});
},

onStationsLoad: function() {
var stationsList = this.getStationsList();
stationsList.getSelectionModel().select(0);
},



However, the following code runs. (But I still get “Uncaught TypeError: Cannot call method ‘getSelectionModel’ of undefined”)


onLaunch: function() {
var stationsStore = this.getStationsStore();
stationsStore.load({
callback: function() {
var stationsList = this.getStationsList();
stationsList.getSelectionModel().select(0);
},
scope: this
});
},


Any idea? Anyone?

Thanks in advance.

tobiu
14 Nov 2011, 4:57 AM
views: ['StationsList'] // creates getter named 'getStationsListView' -> returns reference to StationsList class

rubyrain
14 Nov 2011, 8:57 AM
Thanks tobiu. I got this resolved with 4.0.7 and without adding views: ['StationsList']

However, I'm curious and confused. According to the guide, refs: [ ... ] was for creating getter to views. (and seems to work as of 4.0.7) I thought views: ['viewComp'] config was a short hand for requires: ['app.view.viewComp']

I'm still looking for a knowhow on building MVC app.

WaveCycles
23 Mar 2012, 11:00 AM
Can someone show my in what file and where I need to add to my code in order to fix the

"Uncaught TypeError: Cannot call method 'getSelectionModel' of undefined"

Error..

I need to finish my evalution of ExtJS and want to show the MVC Pandora app to a group next week but need to get it running.

Thanks