Apparently, I cannot comment on the above solution provided by Fujiy, however I found the following error:
Inside GetEnumerator (), incrementing in the else branch always causes the collection to skip one default item if you are not on the last page of the PagedList.
As an example, if you create a computed list of 5 items, with a starting index of 3 and 1 per page. This could introduce an else branch for element 2. It will increase i to 3, and then return to the for header, where it will increase to 4, without creating a default element for i == 3.
- i == 1 -> default
- i == 2 -> default
- i == 3 -> Actual item
- i == 4 β Missed
- i == 5 -> default
A simple solution is to either use 3 for-loops (one for default values ββbefore ActualPage, one for ActualPage and one for items after ActualPage). Or add me - after the For loop inside the Else branch.
source share