简体   繁体   English

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

[英]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. 我正在使用extjs 4。

You never call the superclass store constructor. 你永远不会调用超类商店构造函数。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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