PDA

View Full Version : paging toolbar page not updating



bobmanc
29 Dec 2012, 9:17 AM
I am using a paging toolbar and if I manually click to the second page it works fine but if I then issue a
store().load({params:{start:0,limit:10}}); the load works correctly, the first 10 records are sent back but the toolbar still says Page 2. Any ideas?

I am using ExtJS 4.1. Thanks.

vela1606
30 Dec 2012, 6:31 AM
is your totalProperty correct?




{
"success": true,
"results": 2000, <-------// this
"rows": [ // ***Note:** this must be an Array
{ "id": 1, "name": "Bill", "occupation": "Gardener" },
{ "id": 2, "name": "Ben", "occupation": "Horticulturalist" },
...
{ "id": 25, "name": "Sue", "occupation": "Botanist" }
]
}

talha06
30 Dec 2012, 10:58 AM
Actually you don't need to load store with start and limit parameters. All you need is setting pageSize configuration in your store.

Then you can call store's load method without any extra parameters. Store will take care of start and limit paramaters. It'll load store with incremented start parameter on each page load.

bobmanc
30 Dec 2012, 11:57 AM
The total returned is correct.

I need to reset the start param so it gets the first ten records (which it does) instead of the second ten. Everything on the server side is working correctly. The only problem is the page number doesn't reset to 1 but stays at 2.

talha06
30 Dec 2012, 12:21 PM
so you can use moveFirst method of PagingToolbar component. It should do the same with clicking first page icon on PagingToolbar.

bobmanc
1 Jan 2013, 8:24 AM
That did it. I never would have thought MoveFirst would be the name for the method. It should be SetPage or something similar. Thanks for the help.

talha06
1 Jan 2013, 8:47 AM
glad to be helpful.