1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    2
    Answers
    1
    Vote Rating
    0
    orderofout is on a distinguished road

      0  

    Question Answered: MVC error with automatic function generation

    Answered: MVC error with automatic function generation


    So I'm following along with the MVC part-1 senchacon video (http://www.sencha.com/conference/ses...-in-depth-pt-1) and I've run into an issue...

    I've gotten to the part where I now have several views, and a main controller and now I am attempting to add the functionality to submit the contact form. If it helps I've completed everything up to 28:23 in the video.

    In the video Ed mentions that once you specify a reference to the contact form, a new function is automatically created called this.getContactForm(). When I follow the demo and set the result of that function to a variable and console.log it, as he does in the video - I should get an output of the object.

    Except, I'm getting this result instead.
    Uncaught TypeError: Object [object Object] has no method 'getContactForm'

    Any suggestions on proceeding would be appreciated.

  2. Ok, so I did some digging around and it appears as though some of the configuration has been changed since this video was recorded...

    Here is the main.js in the video...

    Code:
    Ext.define('Sencha.controller.Main', {
        extend: 'Ext.app.Controller',
    
        views: ['Home', 'Products', 'Blog', 'Contact'],
    
        refs: [
            {
                ref: 'contactForm',
                selector: '#contactForm'
            }
        ],
    
        init: function() {
            this.control({
                'button[action=submitContact]': {
                    tap: 'submitContactForm'
                }
            });
        },
    
        submitContactForm: function() {
            var form = this.getContactForm();
    
            console.log(form);
        }
    });
    
    
    Here is what I found in the docs that does work...

    Code:
    Ext.define('Sencha.controller.Main', {
        extend: 'Ext.app.Controller',
    
        views: ['Home', 'Products', 'Blog', 'Contact'],
    
        config: {
            refs: {
                    contactForm: '#contactForm'
                }
        },    
    
        init: function() {
            this.control({
                'button[action=submitContact]': {
                    tap: 'submitContactForm'
                }
            });
        },
    
        submitContactForm: function() {
            var form = this.getContactForm();
    
            console.log(form);
        }
    });
    Note that refs is now inside the config and the actual name of the ref corresponds to the function name that is auto generated.

  3. #2
    Sencha User
    Join Date
    Feb 2012
    Posts
    2
    Answers
    1
    Vote Rating
    0
    orderofout is on a distinguished road

      0  

    Default Solved

    Solved


    Ok, so I did some digging around and it appears as though some of the configuration has been changed since this video was recorded...

    Here is the main.js in the video...

    Code:
    Ext.define('Sencha.controller.Main', {
        extend: 'Ext.app.Controller',
    
        views: ['Home', 'Products', 'Blog', 'Contact'],
    
        refs: [
            {
                ref: 'contactForm',
                selector: '#contactForm'
            }
        ],
    
        init: function() {
            this.control({
                'button[action=submitContact]': {
                    tap: 'submitContactForm'
                }
            });
        },
    
        submitContactForm: function() {
            var form = this.getContactForm();
    
            console.log(form);
        }
    });
    
    
    Here is what I found in the docs that does work...

    Code:
    Ext.define('Sencha.controller.Main', {
        extend: 'Ext.app.Controller',
    
        views: ['Home', 'Products', 'Blog', 'Contact'],
    
        config: {
            refs: {
                    contactForm: '#contactForm'
                }
        },    
    
        init: function() {
            this.control({
                'button[action=submitContact]': {
                    tap: 'submitContactForm'
                }
            });
        },
    
        submitContactForm: function() {
            var form = this.getContactForm();
    
            console.log(form);
        }
    });
    Note that refs is now inside the config and the actual name of the ref corresponds to the function name that is auto generated.

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi