2013-07-29 60 views
0

此代碼:從Ext.data.Store擴展不起作用

 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.

回答

2

您從不調用超類商店構造函數。

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