I am using datefields and comboboxes to make a selection to load a store. When the store is loaded into a grid i have a paging toolbar. So far so good.
When the user clicks on the next page the pagingtoolbar is not sending the data from the datefields with it. I read something about baseparams but this aint working.
I use EXTJS 4.1
This is my store:
NL.commListDetails = new Ext.data.Store({
model: 'stepDetails',
pageSize: 20,
loadMask: false,
sortOnLoad: true,
proxy: {
type: 'ajax',
url: detailURL,
startParam: '',
limitParam: '',
pageParam: '',
reader: {
type: 'json',
root: 'slaevents',
totalProperty: 'slaevents[0].totalCount'
}
},
baseParams: {fromDate:NL.startDate},
autoLoad: false
});
And here is the paging toolbar
bbar: Ext.create('Ext.PagingToolbar', {
store: NL.commListDetails,
displayInfo: true,
displayMsg: 'Displaying record {0} - {1} of {2}',
emptyMsg: "No records to display",
}),
I need to send fromDate, endDate with the paging. Both available in NL.startDate and NL.endDate. How can i send this when i click on next page?
There is no configuration of baseParams for the store. To send extra params you should use the extraParams configuration for the ajax proxy.
Also defining the params when creating the store will mean they are static, so they won;t change if you modify the datefields or comboboxes…
So a fix will be to listen to the change event on the combobox or datefield and reset the extra params:
Edit
I stand corrected. There is a baseParams but it’s on elementloader and that is called only when load is directly invoked, which i think is not the case for the paging toolbar which uses loadPage. I might be wrong on this one, but i’m using extraparams and it works ok.