[viritin] MGrid Lazy loading not as lazy as in MTable

I’ve a strange lazy loading behavior with MGrid. Strange because the very same lazy loading code applied on a MTable works fine (i.e., really lazy) but leads to
many
repeated calls to the pageProvider with the same indexes. Here is what I have:

SortableLazyList beans = new SortableLazyList<>(pageProvider, countProvider, DEFAULT_PAGE_SIZE);
MTable table = new MTable(Problem.class).setBeans(beans).withProperties(Problem.SUMMARY);
MGrid grid = new MGrid(Problem.class).setRows(beans).withProperties(Problem.SUMMARY);

When scrolling in that MTable, my log output in my “SpringSortablePagingProvider” says:

Sat Feb 27 05:44:52 CET 2016: start at row 0 took 56,71 ms
Sat Feb 27 05:44:53 CET 2016: start at row 0 took 54,45 ms
Sat Feb 27 05:44:53 CET 2016: start at row 45 took 67,59 ms
Sat Feb 27 05:44:57 CET 2016: start at row 270 took 74,17 ms
Sat Feb 27 05:44:58 CET 2016: start at row 225 took 77,97 ms
Sat Feb 27 05:44:58 CET 2016: start at row 315 took 79,67 ms
Sat Feb 27 05:44:58 CET 2016: start at row 360 took 76,63 ms
Sat Feb 27 05:44:58 CET 2016: start at row 405 took 59,51 ms

Lazy loading more or less works as expected when scrolling the first 400+ elements (not sure why row 0 is fetched twice but I don’t mind that much).

But when scrolling in the same way inside the MGrid, I get the following loading behavior:

Sat Feb 27 05:50:14 CET 2016: start at row 0 took 60,63 ms
Sat Feb 27 05:50:14 CET 2016: start at row 0 took 55,40 ms
Sat Feb 27 05:50:15 CET 2016: start at row 45 took 67,70 ms
Sat Feb 27 05:50:20 CET 2016: start at row 90 took 54,60 ms
Sat Feb 27 05:50:20 CET 2016: start at row 0 took 53,46 ms
Sat Feb 27 05:50:20 CET 2016: start at row 45 took 61,63 ms
Sat Feb 27 05:50:20 CET 2016: start at row 90 took 62,30 ms
Sat Feb 27 05:50:21 CET 2016: start at row 0 took 56,99 ms
Sat Feb 27 05:50:21 CET 2016: start at row 45 took 63,85 ms
Sat Feb 27 05:50:21 CET 2016: start at row 90 took 58,47 ms
Sat Feb 27 05:50:21 CET 2016: start at row 0 took 55,04 ms
Sat Feb 27 05:50:21 CET 2016: start at row 45 took 66,41 ms
Sat Feb 27 05:50:21 CET 2016: start at row 90 took 59,10 ms
Sat Feb 27 05:50:21 CET 2016: start at row 0 took 57,08 ms
Sat Feb 27 05:50:21 CET 2016: start at row 45 took 65,36 ms
Sat Feb 27 05:50:21 CET 2016: start at row 90 took 57,12 ms
Sat Feb 27 05:50:21 CET 2016: start at row 0 took 56,82 ms
Sat Feb 27 05:50:21 CET 2016: start at row 45 took 66,96 ms
Sat Feb 27 05:50:21 CET 2016: start at row 90 took 58,84 ms
Sat Feb 27 05:50:21 CET 2016: start at row 0 took 58,09 ms

and hundreds lines more with the same pattern: row 0,45, and 90 are loaded many, many times although not necessary - I’m just scolling down… As a result the MGrid is not usable as soon as the first paging calls are required…

Any idea what’s wrong with my MGrid initialization? It actually does not matter whether I set the providers in the constructor or not.

I tested viritin 1.44 and 1.46

Thank you