PDA

View Full Version : Master and child grid + paging question



bryanevil
2 Jul 2010, 3:24 AM
Hi All

How to add extra parameter to server request when I click next page?

By default, when next page click , PagingToolbar send request to server with parameters start=x&limit=x,

but i need include one more which is my parent grid selected record id.

How do i do that?

Bryan

v.madhu
2 Jul 2010, 3:30 AM
You have to check the store object. From there the parameters are submited.
For ex
store.lastOptions.params.yourParem = value;

bryanevil
2 Jul 2010, 4:00 AM
Sorry I still dont understand.

this is my Store:

var MonthlyReportStore = new Ext.data.Store({
autoLoad: true,
proxy: MonthlyReportProxy,
reader: MonthlyReportReader,
writer: MonthlyReportWriter,
autoSave: true,
batch: false,
paramsNames: { start: 'start', limit: 'limit', CompanyId:'CompanyId' },
baseParams: { start: 0, limit: 12, CompanyId:-1}
});This is my parent grid's listener listen to the rowclick event to reload my child grid:


listeners: {
rowclick: function (g, index, ev) {
var rec = g.store.getAt(index);
grid_CompanyID = rec.get('ID');
MonthlyReportStore.reload({ params: { CompanyId: grid_CompanyID} });
}
}It works fine at the parent grid's row click, this is the server request got sent:

http://localhost:3849/WebServices/MonthlyReportService/MonthlyReportService.svc/GetAllbyCompanyId?_dc=1278071698316&CompanyId=26&start=0&limit=12

but after that, when I clicked next page in the child grid, the CompanyId parameter became the baseParams value from the store:


http://localhost:3849/WebServices/MonthlyReportService/MonthlyReportService.svc/GetAllbyCompanyId?_dc=1278071748455&start=12&limit=12&CompanyId=-1
What I want is when I clicked next page in the child grid, the CompanyId should be my parent grid selected record id.

Is this possible?

Bryan

Condor
2 Jul 2010, 4:08 AM
Wrong answer. You need to store the parameters in the store baseParams, e.g.


detailStore.baseParams = {
id: masterId
};
detailStore.load({
params: {
start: 0,
limit: 20
}
});