Results 1 to 3 of 3

Thread: Model's set method not working

  1. #1

    Default Answered: Model's set method not working

    Hi,
    I am newbie to Sencha and was trying to create a model and use the set method but somehow it seems to be giving error that set is not a function. Here is my snippet
    var model = Ext.define('TestModel', {
    extend: 'Ext.data.Model',
    fields: [

    {items: 'aa'},
    {name: 'testField', type: 'string'},
    {name: 'testField1'}
    ]
    });
    var store = Ext.create('TestModel', {
    testField: 'def'
    });
    model.set('testField', 'abc');

    P.S. this is a silly question but my work cant go further without this.

  2. Code:
    var model = Ext.define('TestModel', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'testField', type: 'string'},
            {name: 'testField1'}
        ]
    });
    
    var model= new TestModel({
        testField: 'def'
    });
    
    model.set('testField', 'abc');

  3. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    Code:
    var model = Ext.define('TestModel', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'testField', type: 'string'},
            {name: 'testField1'}
        ]
    });
    
    var model= new TestModel({
        testField: 'def'
    });
    
    model.set('testField', 'abc');
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  4. #3

    Default

    Thanks a lot! it worked

Similar Threads

  1. Loading data via a Model.. model has no method load()
    By rhomb in forum Sencha Touch 2.x: Q&A
    Replies: 10
    Last Post: 12 Sep 2013, 11:40 AM
  2. Model has no method 'validate'
    By sc0ttman in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 24 Jan 2012, 3:26 PM
  3. Replies: 4
    Last Post: 30 Sep 2009, 6:32 PM

Tags for this Thread

Posting Permissions

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