从Ext.data.Store扩展不起作用

时间:2013-07-29 23:30:20

标签: javascript model-view-controller extjs

此代码有效:

        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();

但如果我这样做:

  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();

然后它不起作用,错误很奇怪。我正在使用extjs 4。

1 个答案:

答案 0 :(得分:2)

您永远不会调用超类存储构造函数。

this.proxy = new MyProxy();
this.callParent();
相关问题