-
27 Oct 2011 10:45 AM #1
Use a field other than 'id' for server calls?
Use a field other than 'id' for server calls?
Apologies if this has been asked before its hard to search for

Given a model/store with a defined and working proxy, how do i configure it so it does not submit server calls using id.
For example say i have a server side file representing Cars eg(data/cars.json) and i want to load car 3:
Firebug always shows my browser as requesting data/cars.json?id=3.Code:model.load(3,success...fail...etc
What if i wanted it to use 'carid' eg data/cars.json?carid=3?
Is this possible? I've looked into using the idProperty field in a model but it is either ignored or that's not what it actually does.
I believe what i want is similar to the mapping property that you can define in a writer except for reading.
-
27 Oct 2011 4:08 PM #2
Hi rfox,
This one is so ugly that I'm not even sure I want to post it, but close inspection of Ext.data.Model, Ext.data.proxy.Server and Ext.data.proxy.Ajax only gave one possible solution:Best RegardsCode:model.load(false, { params: {carid: 3} });
-
27 Oct 2011 4:21 PM #3
That's really anoying, id is a reserved cgi variable in both POST and GET for the server side software im using. Pretty much everywhere I want to load data I cannot use ID as its parameter.
The definition of idProperty on the docs is also confusing
. Looks like it only affects the internal storage of the model.
Thanks for your input
-
28 Oct 2011 6:47 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 435
I have moved this to the bugs forum and entered as a bug as the idProperty should change the parameter that is sent back. This isn't a bug per-say but an improvement.
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.
-
31 Oct 2011 6:47 AM #5
Thanks for moving it to bugs its good to know its been acknowledged

-
31 Oct 2011 3:24 PM #6
same problem here, loose 1 day trying to override this and nothing

You found a bug! We've classified it as
EXTJSIV-4319
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote