0

I have bound an xp:repeat control to Domino Access Services (DAS) via a Jersey Client. The JSON is then mapped to a Java object via the Jakcson library.

Since the number of documents displayed via DAS is restricted in the server document I would like to include an infinite scroll function so a next set of documents can be attached to the xp:repeat control.

I wonder how I should this? The numbers in the repeat control I can capture via

var numbers = getComponent("rptPersons").getRowCount();

So I can make a new http call so the URL for the Jersey client becomes something like

db.nsf/api/data/collections/name/people?start=' + (numbers +1) + "&count=" + numbers

But how should I 'inject' the received results into the existing Java object?

Patrick Kwinten
  • 1,988
  • 2
  • 14
  • 26
  • Have you tried a grid together with RESTService object (see Extlib example database)? Another option could be a Dynamic View Panel, again to be tested from the Extlib examples. – Lothar Mueller May 11 '15 at 14:08
  • how much is the limit? – Frantisek Kossuth May 11 '15 at 15:45
  • @Lothar: No I do not want to display the data in a grid format. The final format should be independent from the data so I can display the data as a list, card or whatever format. – Patrick Kwinten May 12 '15 at 06:23
  • @Frantisek: there are no limits. The principe is so generic you could apply it to a names directory, product folder, etcetera – Patrick Kwinten May 12 '15 at 06:24
  • 1
    > Since the number of documents displayed via DAS is restricted in the server document - this seems as limit to me. Everything has its limits. I will try to compose some answer to elaborate the idea, but update your question first: do you need to partial/full refresh the page? What is that "Java object" you map the JSON to? – Frantisek Kossuth May 12 '15 at 07:53
  • the java object is an array. ofcourse I would prefer a partial refresh since a full refresh would be more expensive. – Patrick Kwinten May 12 '15 at 12:28

1 Answers1

0

So, you keep array of elements returned from REST. To fetch more data, you need to use paging feature, as described in the question:

db.nsf/api/data/collections/name/people?start=' + (numbers +1) + "&count=" + numbers

Your problem is to append the new array to the current one, then. Based on this question all you need is to make third array with the size of the both arrays (current.length + new.length) and copy the first (current) array followed by the second (new) array. That's it.

Bear in mind, the array size may get huge after some time, so do not try to cache it for too long (the viewScope is preferred).

Community
  • 1
  • 1
Frantisek Kossuth
  • 3,524
  • 2
  • 23
  • 42