1. #1
    Sencha User
    Join Date
    Nov 2009
    Posts
    10
    Vote Rating
    0
    rubyrain is on a distinguished road

      0  

    Default How to build a MVC app and Controller callback function not firing

    How to build a MVC app and Controller callback function not firing


    While I was following this guide, http://www.sencha.com/learn/architec...t-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.
    Code:
    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”)
    Code:
    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.

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,680
    Vote Rating
    112
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    Code:
    views: ['StationsList'] // creates getter named 'getStationsListView' -> returns reference to StationsList class
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  3. #3
    Sencha User
    Join Date
    Nov 2009
    Posts
    10
    Vote Rating
    0
    rubyrain is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    1
    Vote Rating
    0
    WaveCycles is on a distinguished road

      0  

    Default Also getting this error and don't understand the solution

    Also getting this error and don't understand the solution


    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

Thread Participants: 2

Tags for this Thread