简体   繁体   中英

Extending from Ext.data.Store does not work

This code works :

        var myStore = Ext.create('Ext.data.Store', {
            fields : [ 'abcd' ],
            totalCount : 0,
            proxy : {
                type : 'ajax',
                actionMethods : {
                    create : 'POST',
                    read : 'POST',
                    update : 'POST',
                    destroy : 'POST'
                },
                url : 'abcd.htm'
            },
            autoLoad : false
        });

myStore.load();

But if I do :

  Ext.define('MyStore', {
        extend : 'Ext.data.Store',
        fields : [ 'abcd' ],
        proxy : null,
        autoLoad : false,
        constructor : function (url) {
            this.proxy = new MyProxy(url);  // MyProxy class works
        }
});

var myStore = new MyStore('abcd.htm');
myStore.load();

Then it does not work, error is very strange. I am using extjs 4.

You never call the superclass store constructor.

this.proxy = new MyProxy();
this.callParent();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM