PDA

View Full Version : Customize the page load of grid



harman
18 Mar 2012, 11:36 PM
Hi All,

I have a requirement according to which i load the current page of my paginated grid.
i do
gridStore.loadPage(gridStore.currentPage);
As my records keep changing a scenario comes where 1st time there is only 1 record on the 2nd page
this record gets edited and removed.
Now when i load , since the current page was 2 so it loads 2nd page of grid even if there is only 1 total page. It displays "page 2 of 1".
How do i restrict grid to do not load a page that is greater than total pages?
if i try entering any page number manualy in the pagination toolbar that is greater than total number of pages
it brings me to the last page. Same thing i want to occur with the above code.


Thanks in advance

mitchellsimoens
19 Mar 2012, 8:05 AM
You have 2 pages and when you do the loadPage, there may only be 1 but the grid has no idea. You can return last page and see if that will update the grid but I have a feeling the currentPage will be off then.

harman
20 Mar 2012, 2:17 AM
Isn't it bad that we can load a page that even doesn't exists after we have called the loadPage function.
It doesnt behave this way when we try doing it manually from bottom bar.
Can you suggest whether should i check in load event of store to load the previous page in such case?