1. #1
    Sencha Premium Member Neilcoder's Avatar
    Join Date
    Apr 2011
    Location
    Ireland
    Posts
    247
    Vote Rating
    0
    Neilcoder is on a distinguished road

      0  

    Question Ext.getModel('User') = Error: Object doesn't support this property or method

    Ext.getModel('User') = Error: Object doesn't support this property or method


    Hi,

    I've been reading; http://www.sencha.com/blog/countdown...4-data-package and trying to get the code tow ork for me buton line 28
    Code:
    var User = Ext.getModel('User');
    it fails with the error;
    Error: Object doesn't support this property or method
    Here's the code;

    Code:
    Ext.onReady(function(){
    
    Ext.regModel('User', {
        fields: ['id', 'name', 'age'],
        proxy: {
            type: 'rest',
            url : '/users',
            reader: {
                type: 'json',
                root: 'users'
            }
        }
    });
    
    //uses the User Model's Proxy
    new Ext.data.Store({
        model: 'User'
    });
    
    
    //gives us a reference to the User class
    var User = Ext.getModel('User');
    
    var ed = new User({
        name: 'Ed Spencer',
        age : 25
    });
    
    //we can save Ed directly without having to add him to a Store first because we
    //configured a RestProxy this will automatically send a POST request to the url /users
    ed.save({
        success: function(ed) {
            console.log("Saved Ed! His ID is "+ ed.getId());
        }
    });
    
    //load User 123 and do something with it (performs a GET request to /users/123)
    User.load(123, {
        success: function(user) {
            console.log("Loaded user 123: " + user.get('name'));
        }
    });
    });
    So what is it that I'm doing wrong?

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    9
    Vote Rating
    0
    AlainP is on a distinguished road

      0  

    Default


    I am getting the same error. Did you find the solution?

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Posts
    8
    Vote Rating
    0
    egy is on a distinguished road

      0  

    Default


    extjs docs/tutorial is still in progress...

    about your problem try this one :
    Code:
    var User = Ext.ModelManager.getModel('User');
    it works for me..

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,120
    Vote Rating
    508
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    There's no real reason to use getModel. When you register the model it creates a class.

    So you already have a reference to it:

    Code:
    Ext.define('User', {
        extend: 'Ext.data.Model',
        fields: ['a']
    });
    
    Ext.onReady(function(){
        console.log(User);
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Apr 2013
    Posts
    30
    Vote Rating
    0
    korndeang is on a distinguished road

      0  

    Default


    Quote Originally Posted by egy View Post
    extjs docs/tutorial is still in progress...

    about your problem try this one :
    Code:
    var User = Ext.ModelManager.getModel('User');
    it works for me..

    I follow this but no luck!
    Code:
    Ext.define('CRM.controller.Accounts', {
        extend: 'Ext.app.Controller',
        requires: ['CRM.Utilities'],
        views: [
            'account.Add',
            'account.Edit',
            'account.List',
        ],
        stores: ['Account'],
        models: ['Account'],
       init: function(application) {
              if(this.inited){
                    return;
              }
              this.inited = true;
            
              CRM.Utilities.logShow =true; //Set to TRUE for development 
              this.application.on({
                 scope:this
              });
        },
        accountList: function(){
            //My Account model was success loaded
           // I call accountList() then
          
    
    console.log(Ext.ModelManager.getModel('Account'));//output 'undified'       
            
            
        },

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    10
    Vote Rating
    0
    deepakbellale is on a distinguished road

      0  

    Default It will work

    It will work


    var user = Ext.ManagerModel.getModel(MyApp.model.User);

    It will work like champ..

  7. #7
    Sencha User
    Join Date
    Apr 2013
    Posts
    10
    Vote Rating
    0
    deepakbellale is on a distinguished road

      0  

    Default It will work

    It will work


    var user = Ext.ManagerModel.getModel('MyApp.model.User');

    Sorry i missed quotes...

Similar Threads

  1. GroupingStore error in IE - Object doesn't support this property or method
    By kiranpatil in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 25 Mar 2011, 8:57 AM
  2. Object doesn't support this property or method
    By xjpmauricio in forum Ext 3.x: Help & Discussion
    Replies: 12
    Last Post: 22 Oct 2010, 3:21 AM
  3. GroupingStore error in IE - Object doesn't support this property or method
    By kiranpatil in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 3 Feb 2010, 10:16 AM
  4. Replies: 1
    Last Post: 25 Sep 2009, 8:22 AM
  5. Replies: 0
    Last Post: 13 Aug 2008, 3:58 PM

Thread Participants: 5

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