PDA

View Full Version : Whats wrong with this extend Store



bryanevil
5 Aug 2010, 10:53 PM
Hi all

I couldn't get my extended Store working, I was getting this error -this.buildWriter is not a function. Could you point out whats wrong with my store please?



my.store = Ext.extend(Ext.data.Store, {
autoSave: false,
batch: false,
constructor: function () {
my.store.superclass.constructor.call(this);
this.writer.meta = Ext.applyIf(
{ root: 'd' }, this.reader.meta);
}
});

var CompanyInfoJsonStore = my.store({
proxy: companyinfoProxy,
reader: companyinfoReader,
writer: companyinfoWriter,
autoLoad: { params: { start: 0, limit: my.pagesize.company} },
baseParams: { start: 0, limit: my.pagesize.company, filter: '' }
});

Condor
5 Aug 2010, 11:42 PM
Your my.store.constructor is ignoring the config parameter.


constructor: function (config) {
my.store.superclass.constructor.call(this, config);
this.writer.meta = Ext.applyIf({root: 'd'}, this.reader.meta);
}

bryanevil
6 Aug 2010, 12:00 AM
I still getting error - "this.addEvents is not a function"

any idea why?

Condor
6 Aug 2010, 12:31 AM
var CompanyInfoJsonStore = new my.store({

ps. The convention is to write class names with first letter uppercase and instances with first letter lowercase (you are doing the reverse).

bryanevil
6 Aug 2010, 2:06 AM
var CompanyInfoJsonStore = new my.store({ps. The convention is to write class names with first letter uppercase and instances with first letter lowercase (you are doing the reverse).

My careless mistake, sorry. Programing for too long time...