1. #1
    Sencha User
    Join Date
    Jul 2007
    Posts
    50
    Vote Rating
    0
    olakara is on a distinguished road

      0  

    Exclamation Object #<Object> has no method 'read' error in MVC application

    Object #<Object> has no method 'read' error in MVC application


    Hi all,

    I am trying to build an application using the MVC features. I am following the Application Architecture article provided in the documentation. I was able to implement and run successfully when my store's data is supplied through the data property.

    My trouble starts when I create a model and associate to it the store. And try to get the data from user using a Ajax proxy. I get the following error:

    Object #<Object> has no method 'read'
    I did a search for the error in the forums and found that this error occur when the model is not loaded. But, I do see my model class being loaded by Ext JS and even the Ajax call being made. How do I resolve this error?

    Here is my controller:

    Code:
    Ext.define('AM.controller.Users', {
        extend: 'Ext.app.Controller',
    	stores: ['Users'],
    	models: ['User'],
    	init: function() {
            this.control({
                'userlist': {
                    itemdblclick: this.editUser
                },
    			'useredit button[action=save]' : {
    				click : this.udpateUser
    			}
            });
        },
    
        editUser : function(grid, record) {
    		var view = Ext.create('AM.view.user.Edit');
    		view.down('form').loadRecord(record);	
    	},
    	
    	udpateUser : function(button) {
    		console.log('Clicked the save button');
    	}
    });
    My Store:

    Code:
    Ext.define('AM.store.Users', {
        extend: 'Ext.data.Store',
    	model: 'AM.model.User',
    	autoLoad: true,
        proxy: {
            type: 'ajax',
            api: {
    			read: 'data/users.json',
    			update: 'data/updateUsers.json'
    		},
            reader: {
                type: 'json',
                root: 'users',
                successProperty: 'success'
            }
        }
    });
    The model:

    Code:
    Ext.define('AM.model.User', {
        extend: 'Ext.data.Model',
        fields: ['name', 'email']
    });
    I also checked the order in which the files are loaded by Ext JS. They order of file load is:
    1. Stores
    2. Views
    3. Controllers

    Can somebody help me and point to the correct direction?
    Thanks and Regards,
    Abdel Olakara.
    [ blog : http://technopaper.blogspot.com ]

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    4
    Vote Rating
    0
    kniget is on a distinguished road

      0  

    Default


    I have the exact same problem

  3. #3
    Sencha User
    Join Date
    Jul 2007
    Posts
    50
    Vote Rating
    0
    olakara is on a distinguished road

      0  

    Default


    Finally, fixed the issue by adding
    Code:
    models: ['User'],
    to Application config.
    Thanks and Regards,
    Abdel Olakara.
    [ blog : http://technopaper.blogspot.com ]

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Posts
    4
    Vote Rating
    0
    kniget is on a distinguished road

      0  

    Default


    Got it. Add a 'models' array to your Ext.app.yourapp configuration, listing the required models, same as with views, controllers and stores.

Similar Threads

  1. Uncaught TypeError: Object #<an Object> has no method 'read'
    By babar.sajjad in forum Sencha Touch 1.x: Discussion
    Replies: 14
    Last Post: 19 Nov 2011, 7:17 AM
  2. JSON / Lists / JsonStore & Object has no 'read' method
    By drew5 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 16 Feb 2011, 1:53 PM
  3. Uncaught TypeError: Object #<an Object> has no method 'addEvents'
    By busybee in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 6 Oct 2010, 2:34 AM
  4. Replies: 1
    Last Post: 18 Jun 2010, 12:54 AM

Thread Participants: 1

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..."