Results 1 to 4 of 4

Thread: [PR4] Store load event never called.

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
      0  

    Default [PR4] Store load event never called.

    I have this controller:

    Code:
    Ext
            .define(
                    'TestApp.controller.TestController',
                    {
                        extend : 'Ext.app.Controller',
    
    
                        config : {
                            refs : {
                                testList : '.testView',
                            }
                        },
    
    
                        init : function() {
                            console.log('TestApp.controller.TestController init');
    
    
                            this.control({
                                testList : {
                                    show : this.onShow,
                                    hide : this.onHide
                                }
                            });
    
    
                            var testStore = Ext.getStore('testAppStoreId');
    
    
                            testStore
                                    .on(
                                            'load',
                                            function(store, records, success,
                                                    operation, eOpts) {
                                                console
                                                        .log('TestApp.controller.TestController onStoreLoad');
    
    
                                                console.log(success);
    
    
                                            });
                        },
    
    
                        onShow : function(component, eOpts) {
                            console.log('TestApp.controller.TestController onShow');
    
    
                            var testList = this.getTestList();
                            var testStore = testList.getStore();
    
    
                            testStore
                                    .load({
                                        callback : function(records, operation,
                                                success) {
                                            console
                                                    .log('TestApp.controller.TestController onLoaded');
    
    
                                            console.log(records);
                                        },
                                        scope : this
                                    });
                        },
    
    
                        onHide : function(component, eOpts) {
                            console.log('TestApp.controller.TestController onHide');
                        }
                    });
    and CRUD functionality in my proxy:

    Code:
    Ext.define('TestApp.proxy.TestProxy', {
        extend : 'Ext.data.Proxy',
        create : function(operation, callback, scope) {
            console.log('proxy create');
        },
        update : function(operation, callback, scope) {
            console.log('proxy update');
        },
        destroy : function(operation, callback, scope) {
            console.log('proxy destroy');
        },
        read : function(operation, callback, scope) {
            console.log('proxy read');
    
    
            operation.setStarted();
    
    
            var items = [];
            var item = {
                id : 1,
                value : 'item1'
            };
    
    
            items.push(item);
    
    
            operation.resultSet = Ext.create('Ext.data.ResultSet', {
                records : items,
                total : items.length,
                success : true,
                loaded : true
            });
    
    
            operation.setCompleted();
            operation.setSuccessful();
        }
    });
    
    
    var storeProxy = Ext.create('TestApp.proxy.TestProxy', {});
    
    
    Ext.define("TestApp.model.TestModel", {
        extend : "Ext.data.Model",
        config : {
            fields : [ {
                name : "id",
                type : "int"
            }, {
                name : "value",
                type : "string"
            } ],
            proxy : storeProxy
        }
    });
    How come the 'load' event never gets called in my controller. I do see the 'proxy read' console.log statement in the console. Help?

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
      0  

    Default

    Anybody?

  3. #3
    Sencha User rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,159
    Answers
    93
    Vote Rating
    7
      0  

    Default

    Have you tried Beta 1? Quite a few data issues were fixed in this release. Though we use the load event in store all over the place, so it doesn't really make sense. And your code looks ok with a quick look.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
      0  

    Default

    just tried Beta 1, same behavior. Here is what my store looks like:

    Code:
    Ext.define('TestApp.store.TestStore', {
        extend : 'Ext.data.Store',
        config : {
            model : 'TestApp.model.TestModel'
        }
    });
    
    
    Ext.create('TestApp.store.TestStore', {
        storeId : 'testAppStoreId'
    });
    Can somebody try to reproduce, or tell me what I am doing wrong? I am stuck!

Posting Permissions

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