Dear sir/madam,
I have a view which contains alot of documents, around 2720+. This view is used inside a xPage application where I have created an view control for it. I added an pager to the control and configured it in such a way that it shows me first, previous, next, last links. The first 3 links are shown correct. But for some reason the LAST link is gone? It is substituted by three dots.
Can someone explain why this is happening? Is it because of the size of the view ( too many documents ) or is it a bug in the pager control or something else which I’m missing?
Subject: Strange behaviour
What I just found out was that when the pager is at a certain page before the last one ( say 10 ) the last link is shown. But I want it to be shown always.
Subject: Last page
From what I understand and from speaking to other developers, you’re right that it’s because the size of the view. The XPaes engine is giving up before it can work out the last page.
Apparently there are ways to ‘hack’ it, though I didn’t follow up on how. If you’re not using one of the default pager styles, but building it from the Custom option, it adds each pagerControl as a child of the pager and it’s possible to manipulate things. My initial approach would be to work out the value of where the “Last” pager should start (with SSJS you can use view.getCount(), use @Modulo dividing by the number of rows you’re showing per page, then subtract that remainder from view.getCount() to work out where it wll start. Then I would look at adding a link control to open the view with start=… The calculation of where to start would be different if it’s an uncategorised view. This is theory, so I’m not sure if it would work in practice.
Subject: Using the FIRST property
There is another approach for this which I’m currently testing. It involves settings the ‘first’ property. This property normally controls which row should be shown first. I added an link which populates the sessionscope with a value which is picked up by the viewcontrol.