PDA

View Full Version : paging grid question



bryanevil
24 Jun 2010, 1:02 AM
Hi All

I could not get the parameter from my web service by this line of code:

CompanyInfoJsonStore.load({ params: { start: 0, limit: 4} });

but I could get the parameter from my web service if I do this in HttpProxy

var companyinfoProxy = new Ext.data.HttpProxy({
api:{
// Call web service method using GET syntax
read: '/WebServices/Account/WCFCompanyService.svc/GetAll?start=0&limit=4',
create: '/WebServices/Account/WCFCompanyService.svc/Add',
update: '/WebServices/Account/WCFCompanyService.svc/Update',
destroy: '/WebServices/Account/WCFCompanyService.svc/Delete'
}
});

have I done anything wrong here?

Bryan

jtpacheco
24 Jun 2010, 7:07 AM
First of all, its not "params", its "baseParams".

Second, just as a paranoid check, I'd pass the URL every time as well.

CrazyEnigma
24 Jun 2010, 10:58 AM
@jtpacheco: in this case, bryanevil cannot pass the url every time, because he is using CRUD, but you are right about baseParams.

baseParams need to be specified in the Proxy. params is used when that specific request needs different parameters.

You may want to use FireBug to observe the parameters being sent.

jtpacheco
24 Jun 2010, 11:00 AM
Bah, you're quite right. Don't even know why I didn't acknowledge that.

bryanevil
24 Jun 2010, 6:45 PM
@jtpacheco: in this case, bryanevil cannot pass the url every time, because he is using CRUD, but you are right about baseParams.

baseParams need to be specified in the Proxy. params is used when that specific request needs different parameters.

You may want to use FireBug to observe the parameters being sent.

Hi CrazyEnigma


I havnt done anything like this complex before in client script. Could you give more detail on this?

I have read this post:
http://www.sencha.com/forum/showthread.php?93921-CRUD-and-Form-Submit-Documentation

and I do the same in my JsonReader

var companyinfoReader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
root: 'Data',
idProperty: 'ID',
messageProperty: 'message',
// map to MonthlyReportDTO
fields: ['CompanyName', 'ID'],
paramOrder: ['start', 'limit'],
paramsNames: { start: 'start', limit: 'limit' },
baseParams: { start: 0, limit: 20 }//,
// paramsAsHash: false

});
In this way , Extjs does not post back anything from browser

CrazyEnigma
26 Jun 2010, 9:14 PM
Looks right to me. Is this in a Store? Did you request to load the data into the store?

Animal
26 Jun 2010, 10:58 PM
looks wrong to me

http://i131.photobucket.com/albums/p286/TimeTrialAnimal/paramNames.jpg