-
10 Jan 2012 6:46 AM #1
JsonStore forces proxy type "Ajax" despite definitions in a new class
JsonStore forces proxy type "Ajax" despite definitions in a new class
REQUIRED INFORMATION
Ext version tested:- Sencha Touch 2.0PR3
Description:- A store that extends from JsonStore will be created with ajax proxy by default, ignoring any other proxy declaration made.
Steps to reproduce the problem:- Create a store that extends from JsonStore
- Add a proxy property with localstorage type for instance
- Create an instance of this new store and retrieve its proxy "getProxy().type"
The result that was expected:- "localstorage"
The result that occurs instead:- "ajax"
Test Case:
Code:Ext.define('Pistachio.store.Events', { extend: 'Ext.data.JsonStore', storeId: 'Events', proxy: { type: 'localstorage', id: 'example-events' } }); console.log(Ext.getStore('Events').getProxy().type) // outputs "ajax"
Possible fix:- not provided
-
10 Jan 2012 10:42 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Looking at the source for the JsonStore, the proxy is checked on the config so therefore if you wanted to override the functionality you would have to do this:
Code:Ext.define('Pistachio.store.Events', { extend: 'Ext.data.JsonStore', constructor : function(config) { if (!config) { config = {}; } Ext.applyIf(config, { type : 'localstorage', id : 'example-events' //wouldn't use a set id unless you are only going to have one instance }); this.callParent([config]); } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
10 Jan 2012 11:11 AM #3
Ok, but perhaps using JsonStorage defaults to ajax and it probably shouldn't, since AbstractStore does not nor Store itself. This, at the very least, leads to confusion.
In any case, I am forced to use id I believe:
Code:if (this.id === undefined) {Code:Ext.Error.raise("No unique id was provided to the local storage proxy. See Ext.data.proxy.LocalStorage documentation for details"); }
-
10 Jan 2012 11:15 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Yes you are forced to use id but if you have one set in the class definition then that id will be shared among all instances
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
10 Jan 2012 12:11 PM #5
True that. But that's not question. Now that you guys know what I mentioned above my job is done

-
13 Jan 2012 10:35 AM #6Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Haarlem, Netherlands
- Posts
- 1,235
- Vote Rating
- 4
This has been fixed as part of the Data Package cleanup and will be part of the next Touch 2.0 release. Thanks for the report again!
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-1372
in
2.0.


Reply With Quote
