1. #11
    Sencha User FlaminPhoenix's Avatar
    Join Date
    May 2009
    Posts
    146
    Vote Rating
    0
    FlaminPhoenix is on a distinguished road

      0  

    Default


    As usual no word from ExtJS community support team, nor the devs. I have done all of the above and cannot, for gods sakes, understand why my model doesnt get loaded when I have been following the example all along in the documentation's "application architecture" page.

    Jack, If youre reading this: Please, please, please get a proper community support team together first. It isnt practical for everyone out there to get your premium training lessons!!
    No one stands taller than the last man standing

  2. #12
    Sencha User
    Join Date
    May 2011
    Posts
    9
    Vote Rating
    0
    neonshark is on a distinguished road

      0  

    Default


    The most probable problem in this case is the absence of store's model's definition.
    Either require of model's file or inclusion of model's source into store's stack of code will solve the problem.

    That's all.

  3. #13
    Ext JS Premium Member neongrau's Avatar
    Join Date
    Mar 2007
    Posts
    249
    Vote Rating
    0
    neongrau is on a distinguished road

      0  

    Exclamation


    *sigh*

    this bug wasted at least 2 hours of my time.

    i was working solely in Firefox /w Firebug where you don't even see the error.
    Only when i tried in Chrome, close to giving up, i saw this message and googled to find this thread.

  4. #14
    Sencha User
    Join Date
    Dec 2011
    Posts
    1
    Vote Rating
    0
    anton.dukhanin is on a distinguished road

      0  

    Lightbulb


    Got same problem in my code.

    I have a store with json proxy and custom model. But it throws an error
    "Uncaught TypeError: Object #<Object> has no method 'read'"

    Code:
    var store = Ext.create('Ext.data.Store', {            model: modelClass,
                proxy: {
                    type: 'ajax',
                    url : this.baseUrl + 'list/',
                    reader: {
                        type: 'json'
                    }
                },
                autoLoad: true
            });

    Yes, as sombody told here - problem in model class includion. But Ext.require(modelClass) doesnt helps at all. After that i tryed Ext.create() method, to include class and to create instance. And store began work properly.

    So, there some problem in Ext.require(). Alternativly you can use Ext.create() instead Ext.require() in simillar cases:

    Code:
    Ext.create(modelClass);
    var store = Ext.create('Ext.data.Store', {            model: modelClass,
                proxy: {
                    type: 'ajax',
                    url : this.baseUrl + 'list/',
                    reader: {
                        type: 'json'
                    }
                },
                autoLoad: true
            });

  5. #15
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
    irsilapan is on a distinguished road

      0  

    Default


    Quote Originally Posted by medusadelft View Post
    When trying to use the examples from the proxy.Ajax page (http://docs.sencha.com/ext-js/4-0/#/...ax-method-read), section Url generation in an MVC controller, I get the mentioned error again.

    Moving the declaration of models above the stores doesn't help. I ended up with adding a model to the proxy. The model itself is a faker with just one field defined.
    PHP Code:
    Ext.define('EX.model.Faker', { 
        
    extend'Ext.data.Model'
        
    fields: [
            {
    name'id'type'int'}
        ]
    }); 
    This seems to work (at least, the error is gone). Apparently, even a proxy needs a model. (The documentation says so, so the examples in that same document are WRONG!).

    Update: the model in the proxy doesn't even have to exist! If you do not declare the model in the controller models property, but only add model: 'Faker' to the proxy, it seems to fire the read event...
    PHP Code:
            var operation = new Ext.data.Operation({
                
    action'read'
            
    });
            var 
    proxy = new Ext.data.proxy.Ajax({
                
    api: {
                    
    read"do_something.php"
                
    }
                ,
    model'Faker'
                
    ,reader: {
                    
    type'json'
                    
    ,root'response'
                
    }
            });
            
    proxy.read(operation); 
    Is this applicable to Sencha Touch 1.x?

    In your code,is the line with read config (read: "do_something.php") similar to the one usually placed in the url config?

    Ext.regStore('StoreName', {
    model: 'ModelName',
    autoload: true,
    proxy: {
    type: 'ajax',
    url: 'do_something.php',
    reader: {
    type: 'json',
    root: 'results'
    }
    }
    });

    I am also encountering the Uncaught TypeError: Object #<Object> has no method 'read'. I've tried putting the model, controllers,stores,views arrays. But still it's not working. I'm trying to figure out a way to convert my code similar to yours. I'm assuming it works?

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. Replies: 5
    Last Post: 3 Jun 2011, 6:35 PM
  3. IndexBar ( Uncaught TypeError: Object has no method 'getItemId' )
    By ushiday in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 14 Oct 2010, 7:53 PM
  4. 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
  5. Replies: 1
    Last Post: 18 Jun 2010, 12:54 AM

Thread Participants: 10