Results 1 to 3 of 3

Thread: Model -> Convenience Methods

  1. #1
    Sencha User
    Join Date
    Jun 2009
    Location
    Burlington, Ontario
    Posts
    175
    Answers
    3
    Vote Rating
    2
      0  

    Default Answered: Model -> Convenience Methods

    If I have a model defined as

    PHP Code:
    Ext.define('AppConfig.model.User', {
        
    extend 'Ext.data.Model',
        
    fields : [ 
               { 
    name 'id',type 'integer'    }, 
               { 
    name 'description',  type 'string'    }
       ]
    }); 
    Will the framework automatically add the methods getId(), getDescription()?

    I do not see these in my code, but wondering if it is possible I am missing something that would create them.

  2. No, you have to use the get method:

    Code:
    record.get('description')
    Ext.data.Model does have a getId method defined but it's not created from the field, it's defined as a class method.

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,381
    Answers
    3997
    Vote Rating
    1536
      0  

    Default

    No, you have to use the get method:

    Code:
    record.get('description')
    Ext.data.Model does have a getId method defined but it's not created from the field, it's defined as a class method.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Jun 2009
    Location
    Burlington, Ontario
    Posts
    175
    Answers
    3
    Vote Rating
    2
      0  

    Default

    Thanks, appreciate the quick response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •