View Full Version : Turn off Prefetch for Buffered Grids?

26 Feb 2013, 11:30 AM
Buffered grids always do 3 queries, for a total of 3 pages at the initial load.

This is 2 unnecessary queries against our database since in most cases our users do not scroll past page 1.

Is there a way to reduce the prefetch page count to 1 instead of 3? I cannot find a setting in the docs nor is it a setting in the Infinite Scrolling Grid Tuner example.

What I would like to happen is to only have page 1 (as defined by the page size) load into the grid. If the user starts scrolling and hits a fetch point, then do the query for that page.

26 Feb 2013, 11:38 AM
The config properties in the store below handles the prefetching:

Without testing i would try using a leadingBufferZone with the same value as pageSize (if you want to prefetch one extra page).

Good luck!

26 Feb 2013, 3:24 PM
Thanks, based on your suggestion I tried reducing leadingBufferZone in the Tuner to less than the PageSize and that reduced the prefetches to 2.

I then set leadingBufferZone = 0 and that reduced prefetch to 1 (my goal). Unfortunately, I started scrolling and when I got to row 295 (my pageSize is 300), the Tuner did 8 prefetches all for the same page - page 2.

I guess I will test this setting in my application to make sure the 8 fetches is not a bug in the Tuner. If it still happens, it has to be a bug in the grid.

26 Feb 2013, 3:42 PM
I don't get 8 prefetches in the application so that is good. Now I just need to find a fetch point for the second page to load as you easily scroll past the spot where there are no more rows to display and the scroller will just keep going. I guess that could be a bug. Why keep scrolling if there are no rows left in the page to display?

26 Feb 2013, 11:53 PM
Have you set a correct "totalProperty" on the reader?


27 Feb 2013, 10:25 AM
Yes, the grid knows the total number of rows and the scroll bar is set correctly. In fact, that is why the grid will keep scrolling past page 1 into an empty page 2. If you release the down arrow to stop scrolling, the grid will realize it needs more rows and will query for Page 2. At that point the blank spot in the grid will fill with the fetched rows.

I guess the grid can't do a query while I have the down button pressed although that was my logic on why the scrolling annoyingly pauses about every 10 rows.

27 Feb 2013, 10:44 AM
I don't understand what's missing now. Can you explain what the current issue is?

28 Feb 2013, 8:21 AM
Sorry, nothing is missing. You answered by question.

By setting leadingBufferZone = 0, the number of prefetches will reduce to 1 (which is what I wanted) but that introduced another problem with the scrolling.

I think this a bug and will report it.

Thanks again for your help.

28 Feb 2013, 8:35 AM
No problem, glad to help:) Make sure to mark the post as "best answer" to let other forum user know what the answer to your question was!