-
1 Dec 2008 10:46 PM #1
[2.2][CLOSED] SimpleStore is not extendable
[2.2][CLOSED] SimpleStore is not extendable
Hello I'm trying to implement a custom SimpleStore using extend but the follow code fails with
http://www.extpaste.com/#1739
config.id config is undefined (in firebug) at line 11103 in ext-2.2/ext-all-debug.js that line is the prototype for SimpleStore.
The documentation for SimpleStore says id is optional, although setting id on my subclass does not solve the issue.
as I said about I'm trying to implemente a ComboBox backed by a SimpleStore that will display different options depending on a parameter passes to the store at instantiation time.
-
1 Dec 2008 10:50 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
You assume that 'fields' and 'data' are properties, but they are only config options!
Try:
Code:Ext.namespace('projectone'); projectone.NotSoSimpleStore = function(config) { projectone.superclass.constructor.call(this, Ext.apply({ fields: ['name'], data: [['=='], ['!='], ['>'], ['>='], ['<'], ['<='], ['contains'], ['not contains']] }, config)); } Ext.extend(projectone.NotSoSimpleStore, Ext.data.SimpleStore, {});
-
2 Dec 2008 8:25 AM #3
Thanks for your solution Condor, you are right I assumed the SimpleStore had fields for those which now I understand where not. Here is my current solution in case someone was looking for something similar. Also there is a little typo with your solution with the superclass call.
Code:projectone.NotSoSimpleStore = function(config) { if (config.type == "string") { var mydata = [['=='], ['!='], ['contains'], ['not contains']]; } else if (config.type == "int") { var mydata = [['>'], ['>='], ['<'], ['<=']]; } else if (config.type == "date") { var mydata = [['>'], ['<']]; } else { var mydata = [['=='], ['!='], ['>'], ['>='], ['<'], ['<='], ['contains'], ['not contains']]; } projectone.NotSoSimpleStore.superclass.constructor.call(this, Ext.apply({ fields: ['name'], data: mydata, }, config)); } Ext.extend(projectone.NotSoSimpleStore, Ext.data.SimpleStore, {});


Reply With Quote