PDA

View Full Version : cant make infinte grid work



pm100
28 Dec 2011, 5:58 PM
My infinite grid app no longer works. I have changed it to mathc the new calls in the infinte grid demo but it still doesnt work. Now it could be that my proxy (its my own customer proxy) is the piece thats failing.

As far as I can see the store, scroller or grid did not see the operation end (LoadMask is displayed). I see the store onProxyPrefetch being called so we get a long way into post-processing but its hard to follow from there given that something is not being called (cant put a breakpoint on it!)

mitchellsimoens
29 Dec 2011, 9:11 AM
Any errors? Kind of hard to help with just saying it's not working.

pm100
29 Dec 2011, 9:48 AM
The behavior I see is that the 'loading' mask is shown on the grid and then nothing

My proxy is called and returns the data

the prefetch works, the cb from that calls guaranteeRange; which also works. All looks good (I have the correct number of records in the store etc) but nothing gets displayed, the pagingscroller gets it onGuaranteeRAnge called

I have changed the load sequence slightly so that the grid gets rendered before the store is assigned - in that case I never get the loading mask, but the rest of the behavior is the same

I am trying to step through the working infinite grid demo and see where my code diverges

pm100
29 Dec 2011, 10:33 AM
ok - I cracked this one. Because reconfigure can no longer be made to work with infinite grid I changed my app to make a new grid each time I display fresh data. I was drawing it wrong

now my problem is that page 2 doesnt display :-(

I'll work that one out

pm100
29 Dec 2011, 10:52 AM
Well now I am confused by the page 2 issue

the scroller calls guaranteeRange with start = 36, end = 85 (I have page size = 50)

gr in store does

start = Math.min(Math.max(start - me.numFromEdge - ((me.leadingBufferZone - me.trailingBufferZone) / 2), 0), me.totalCount - me.pageSize);

the answer to this is 0

so it now tries to prefetch rows 0-49; which it already has so no IO gets done. (Note that the loadmask is not turned off in this code path)

I dont understand that calculation but its certainly wrong

kevhender
3 Jan 2012, 8:14 AM
I am seeing issues with this too. I am prefetching 100 items per page, and there are about 330 total items. When I scroll down past the first 100 prefetched items, the loadmask doesn't appear but the next 100 items are correctly loaded. Then if I slowly scroll down further, the loadmask finally appears but there is nothing to load now, so the grid gets stuck just on the loadmask.

Like pm100 said, there is some goofy calculation somewhere that isn't quite right...

pm100
3 Jan 2012, 9:23 AM
I found that setting the pagesize really doesnt work. You have to let the grid work it out for itself

You do then end up with 2 other issues (reported elsewhere by me)

a) The grid will refetch the data from the store if you scroll up and down a little even though its in the stores cache. This happens if the totalCount for the data set is < the calculated page size

b) the last row is not displayed. This is the result of another set of complicated calculations

kevhender
3 Jan 2012, 12:40 PM
Ok, I figured out a sorta hackish way to fix this, maybe somebody can tell me if this is "acceptable" or if there is something else I should be doing. It seems like you have to directly access the PagingScroller so that it is initialized.

First, I had to add these config params to my store (it was using the store's values for these, rather than the PagingScroller's values):


leadingBufferZone: 15,
trailingBufferZone: 5


Previously, I was doing this in the initComponent of my grid:


me.store.prefetchPage(1, {
start: 0,
limit: 100,
callback: function() {
me.guaranteeRange(0, 99);
}
});


I changed it to this, and it seems to be working right now:


me.store.prefetchPage(1, {
start: 0,
limit: 100,
callback: function() {
me.verticalScroller.doAttemptLoad(0, 99);
}
});