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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar