PDA

View Full Version : Undefined parentPrototype when inheriting a store



Ronaldo
27 Jul 2011, 2:15 AM
Hi all,

I'm trying to inherit an Ext.data.Store, and I keep getting an error that

parentPrototype is undefined
parentStatics = parentPrototype.$inheritableStatics;
in ext-dev.js line 5713

(All references are autoloaded perfectly and they exist afaik)



Ext.require('Ext.data.Store');
Ext.require('Ext.data.Request');

Ext.ns('Lk.store');
Ext.define('Lk.store.SchoolGroupStore', {
extend : 'Ext.data.Store',
singleton : false,
requires : ['Lk.model.SchoolGroup'],
model : 'Lk.model.SchoolGroup',
autoLoad: true,
proxy: {
type: 'ajax',
url : '/backoffice/schoolgroup/listEntity',
reader: {
type : 'json',
root : 'rows',
totalProperty : 'rowCount',
successProperty: 'success'
}
},
constructor : function() {
this.callParent(arguments);
}
});

Ext.define('Lk.store.SchoolGroupStore2', {
extend : 'Lk.store.SchoolGroupStore',
singleton : true,
requires : ['Lk.model.SchoolGroup'],
model : 'Lk.model.SchoolGroup',
autoLoad : true,
remoteFilter: true,
proxy: {
type: 'ajax',
url : '/backoffice/schoolgroup/listEntity',
reader: {
type : 'json',
root : 'rows',
totalProperty : 'rowCount',
successProperty: 'success'
}
},
constructor : function() {
this.callParent(arguments);
}
});


The reason I want to inherit a store is to create a base store with all my default properties, like a common proxi api setting based on the model name:



Ext.ns('Twensoc.data');
Ext.define('Twensoc.data.BaseStore', {
extend : 'Ext.data.Store',
requires : ['Ext.data.Store'],
singleton : false,
autoLoad: false,
remoteFilter: true,
model : 'Lk.model.SchoolGroup'
,
proxy: {
type: 'ajax',
url: 'undefined',
reader: {
type : 'json',
root : 'rows',
totalProperty : 'rowCount',
successProperty: 'success'
}
},
constructor : function() {
var prefix = this.prefix;
// derive the proxy api url's based on the modelname
var modelName = this.model.split(".");
modelName = modelName[modelName.length-1];
this.proxy.api = {
read : prefix + modelName+'/listEntity',
create : prefix + modelName+'/createEntity',
update : prefix + modelName+'/saveEntity',
destroy : prefix + modelName+'/deleteEntity'
};
this.callParent(arguments);
}
}
});


Am I doing something wrong or overlooking something?

Ronaldo