-
14 Mar 2013 10:09 PM #1
Model and Rest proxy. Query id parameter in the GET request url
Model and Rest proxy. Query id parameter in the GET request url
Hi everyone.
I'm a little bit stuck here. My model code is
Code:Ext.define('MyFancyModel', { extend: 'Ext.data.Model', fields: [ { name: 'id', type: 'string' }, { name: 'name', type: 'string' } ], proxy: { type: 'rest', url: '/fancymodel', noCache: false } });
When I try to load data by id using
Code:Ext.ModelManager.getModel('MyFancyModel').load('some-id', {});
the request url is /fancymodel/some-id?id=some-id which is obviously not correct. Is there any way to achieve the right request url /fancymodel/some-id without any patches or overrides?
JSFIDDLE
In the developer console you can see failed GET request
Code:http://fiddle.jshell.net/fancymodel/some-id?id=some-id
-
17 Mar 2013 7:39 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
What Ext JS 4.x.x version are you using? I believe this was fixed in 4.1.3 and 4.2.0
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.
-
18 Mar 2013 12:40 AM #3
-
18 Mar 2013 5:52 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
In 4.1.3 and 4.2.0 this has actually been fixed and a new config was added to opt in to sending the id parameter meaning by default it won't send it.
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.
-
18 Mar 2013 10:31 PM #5
My own observation is that the parameter is still being sent with 4.2.0.
Any hints what the setting is called? I've just looked through the 4.2 source code and it isn't immediately obvious.
It'd be nice if idParam could be set to null but, unfortunately, that doesn't work.
-
18 Mar 2013 10:44 PM #6
-
19 Mar 2013 5:01 AM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
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.


Reply With Quote