-
27 Nov 2012 6:14 AM #1
Answered: How pass additional parameters to index action in Rest proxy?
Answered: How pass additional parameters to index action in Rest proxy?
Hi,
I'd like to add a static param to be sent when fetching records using Rest proxy. I tried adding it to "extraParams" in proxy config, but then they are sent on *every* request, while I want them to be sent only on index action.
Also, I'm currently dynamically adding authentication token to every request in "beforeload" and "beforesync" listeners (it sucks that extraParams can't be a function that returns an object).
What's the best way to add custom params just to "index" requests?
Cheers,
Szymon
-
Best Answer Posted by mitchellsimoens
As the docs state, extraParams will be included in every request so yes, you would have to listen to beforeload/beforesync to add params to the request.
-
28 Nov 2012 7:46 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
As the docs state, extraParams will be included in every request so yes, you would have to listen to beforeload/beforesync to add params to the request.
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.
-
29 Nov 2012 12:52 AM #3
Thanks.
It sucks that extraParams can't be a function, because now I have to set the same thing in beforeload and beforesync handlers. It would be awesome if I could do something like this:
and then just add additional filtering params to index requests in beforeload handlers.Code:config: { extraParams: function () { return { auth_token: MyApp.user.getAuthToken() } } }


Reply With Quote