On a sencha-touch, here's is my store declaration
Ext.regStore('newsStore', {
model: 'News',
autoLoad: true,
proxy: {
type: 'ajax',
url: '../news/list.form?format=json',
reader: {
type: 'json',
root: ''
}
},
});
How can I modify params? I tried
params:{ format: 'json'}
But its doesn't work!
Store declaration
new Ext.data.Store({
model:'prj.models.ContactInfo',
storeId:'contactInfoId',
proxy:{
type:'ajax',
url:'/GetContactInfoByID',
reader:{
type:'json'
},
extraParams:{
format:'json'
},
listeners:{
exception:function(proxy, response, orientation){
console.error('Failure Notification', response.responseText);
Ext.Msg.alert('Loading failed', response.statusText);
}
}
}
});
Adding params to proxy and read ajax store
prj.stores.contactInfoId.getProxy().extraParams.partyID = options.partyID;
prj.stores.contactInfoId.getProxy().extraParams.eventName = options.eventName;
prj.stores.contactInfoId.read();
Hope this helps.
For dynamically setting extra parameters:
If you want to set single parameter at a time, you can use following
var proxy= myStore.getProxy();
proxy.setExtraParam('param1', 'value 1' );
proxy.setExtraParam('param2' , 'value 2' );
myStore.load();
If you want to set multiple parameters at a time, you can use following
proxy.setExtraParams({
'param1':'value 1',
'param2':'value 2'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With