PDA

View Full Version : loading store from webservice



santosh.kumar
12 Dec 2012, 6:58 AM
Hi,

I am learning extjs.

In MVC i want to show list of items from webservice. I created listbox and store. Now the challenge is making webservice call from store and loading it. Here is my store making ajax call. Webservice is capable of returning JSON data.




Ext.define('HEAT.ApplicationSetup.store.import.Schedules', {
extend: 'Ext.data.Store',
model: 'HEAT.ApplicationSetup.model.Schedules',


autoLoad: false,
//method: 'POST',
params: { 'authToken': sessiontoken },

proxy: {
type: 'ajax',
noCache:false,
url: localhosturl + '/AdminUI/services/AdminAPI.asmx/IntegrationGetSchedules',
reader: {
type: 'xml' //'json'
},


//extraparams: {
// '_authToken': sessiontoken
//},
//actionMethods: 'POST' ,
afterRequest: function (req, res) {
console.log("Ahoy!", req.operation.response);
}
},
});



1. This call appends paging parameters on top of actual parameters. how to get rid of them?
2. Is above code is the right approach for a web service call?

Thanks
Santosh

mitchellsimoens
14 Dec 2012, 6:17 AM
In the proxy, the pageParam and others, set them to false and the param shouldn't be sent.

Also be careful when you are overriding methods on the classes like you are with afterRequest, you can easily break things as I'm sure you may be doing.