View Full Version : mapping to pager

31 Jan 2013, 6:02 AM
I need some help to map a selected item from a combobox to a page. I have some data that displays 12 records per page (1 year). on top of that grid I have a pager on the toolbar and a a combobox with all existing years.
I need help to map the selected year to the page that contains those records from that year.

here is a pic of what I have so far...

31 Jan 2013, 8:23 AM
This may not be the best/proper way to do this, but it works...

Having said that, you can tack on an extraParam to the grid store's proxy, then reload the store (where of course your server-side code must accept the request parameter and filter the dataset accordingly):

yourGrid.getStore().proxy.extraParams = {
selectedYear: comboxYearValue


31 Jan 2013, 10:42 AM
the data is already loaded to the store when I want to make the selection to that year. I do not want to make extra trip to the server so I can load the data. I only want to map the year to the page where the records that belong to that year exist so that I still keep all available years to be paged.
(sorry for my English)

31 Jan 2013, 12:37 PM
Since you're using a paging toolbar, I don't think you have much choice other than to poke the serverside again; otherwise your page numbers and total records will be wrong. Using a Paging Memory Proxy may work around this, but I'm honestly not sure.

5 Feb 2013, 9:25 AM
okay I got it!

onYearSelect: function(self){ // var firstYear is always going to
// give me the first year in my store
var firstYear = self.store.data.items[0].data.Year;
var selectedYear = self.getValue();
var page = selectedYear - firstYear + 1;