-
5 Dec 2011 7:23 AM #1
Answered: HowTo pass an id to proxy in data.store
Answered: HowTo pass an id to proxy in data.store
Hi
I was wondering how I can pass an id to the ajax proxy
I tested the id ouside the proxy and there the console.log shows my id but within the proxy it's undefinedCode:var storeWebpage = new Ext.data.Store({ model: 'ListItem1', autoLoad: false, //remoteFilter: true, //sortOnFilter: true, //sorters: [{property : 'lastname', direction: 'ASC'}], pageSize: 1, clearOnPageLoad: false, listeners: { load : function(){ console.log(this.sid); } }, proxy: { type: 'ajax', url: 'http://www.hws-koeriers.nl/hws/flex/user.php?sid=' + this.sid, reader: { //root: 'profile', type: 'json' }, extraParams: { rpp: 1, suppress_response_codes: true } } });
test code
listeners: {
load : function(){
console.log(this.sid);
}
},
I am passing the variable from an onItemDisclosure
thanks in advanceCode:onItemDisclosure: { scope: 'this', handler: function(record, btn, index) { //alert('Disclose more info for ' + record.get('id')); storeWebpage.sid = record.get('id'); panel.setActiveItem(3, {type: 'slide', direction: 'right', params: { sid1: record.get('name')}}); storeWebpage.load(); } },
-
Best Answer Posted by mitchellsimoens
If you want it in your storeWebpage.load(); call you can add it as a param:
Or you can apply it to the extraParams if you need it to stick around (like when you refresh or load a new page):Code:storeWebpage.load({ params : { id : 'foo' } });
Code:storeWebpage.proxy.extraParams.id = 'foo';
-
5 Dec 2011 9:40 AM #2
Sorry, could you explain your issue a little more? I'm not sure where you want an ID and why.
Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
5 Dec 2011 9:51 AM #3Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 435
- Answers
- 3106
If you want it in your storeWebpage.load(); call you can add it as a param:
Or you can apply it to the extraParams if you need it to stick around (like when you refresh or load a new page):Code:storeWebpage.load({ params : { id : 'foo' } });
Code:storeWebpage.proxy.extraParams.id = 'foo';
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.
-
5 Dec 2011 10:52 AM #4
Thank you verry much
that was just what I was looking for ..
-
23 Jan 2012 10:58 AM #5
Is there any way to prevent the proxy from sending the other parameters (i.e. _dc, start, limit) on a stores load() call? My backend is expecting to use every parameter sent back for filtering purposes. For the time being I've set it up to just ignore those listed above, but I've just run into a situation where Sencha is sending sending a filter parameter, and it seems like it would just be easier to have all the parameters (besides those I specify) left out entirely. Thanks!


Reply With Quote