PDA

View Full Version : LiveGridView pre caching problem



TMAPRICER
23 Mar 2011, 2:23 AM
Hello,

I'm using the LiveGridView component of GXT 2.2.0 with RPC Proxy.

I detect a problem on the pre caching functionnality when the total count of lines is between 160 and 200 (in the default precaching interval).

When I scroll to the bottom of the grid, the LiveGridView launch a RPC call to my server and all data are reloaded even if the cache already contains the same data.

It seems the test in the method shouldCache() is incomplete :



protected boolean shouldCache(int index) {
int cz = getCacheSize();
int i = (int) (cz * getPrefetchFactor());
double low = liveStoreOffset + i;
double high = liveStoreOffset + cz - getVisibleRowCount() - i;
if ((index < low && liveStoreOffset != 0)
|| (index > high && liveStoreOffset != totalCount - cz)) {
return true;
}
return false;
}


The cache is reloaded even if totalCount is lower than the cache size (cz).

In this case, each time you move the scrollbar in the precaching zone, data are reloaded uselessly.

This problem creates an endloopless behaviour in my application because when user comes back on the grid after having moved the scrollbar, we restore the scrollbar to the last saved position.

So to fix this problem I extends the shouldCache method and add the condition if(totalCount > cz).

Have you already noticed this problem ? Is there a GXT version that fixed it ?

Thanks for your reply.