I want to create pagination for listitems by loading data from JSDO (not from database). It needed for my ProKB Mobile project (http://goo.gl/tg0zlP) to create pagination for ProKb articles list and considering search query.I think that in this case it is better to work with the results in JSDO, and not to request constantly to the database.
Unfortunately I have not found a suitable example to understand how to do it.
I would be grateful if someone share such example.
Russian Progress User Group
I do not have an example, but I wanted to give you some suggestions.
In most cases, you would want to do data pagination from the server (database). In this way, you can return a subset of records instead of a large number of records to correspond to the the result that you want to browse.
Currently, there is no built-in support for data pagination. However, you can use the approach used in the Sports 2013 sample app ( oemobiledemo.progress.com/preview1.html ).
This sample app adds a "record id" field to the temp-table and uses a callback method for an AFTER-ROW-FIELD in the Business Entity to populate the field with the ROWID of the record in the database.
The client code then keeps track of the record id for each page. Then it passes the record id of the last record in the page in the filter parameter so that the Business Entity can return a new page starting from this record (this means that this record is now the first record in the page). The Business Entity uses the RESTART-ROWID method of the DATA-SOURCE to read the records from the page. BATCH-SIZE is used to specify the number of records to return.
We currently, have this approach described in one of the our training materials but not in the documentation.
Something that we have considered as a future enhancement, is to have built-in support for data pagination in the JSDO so that it can download pages of data and cache the data in the JSDO memory.
In regards to doing data pagination from the JSDO and using JSDO Services, there is no specific support to do this.
I would not like to recommend this approach because the JSDORead code is something that we would be enhancing and changing in the future. (We could add hooks or an approach that would allow you to change some behavior of the service.)
Here is a possible approach if you still want to try it.
You can access the JSDO local memory using the getData() method. This method returns the data as an array. You would have to keep a variable (localStorage) with the page number. Then in the JSDORead code, you can set than when readLocal is set (this is a parameter to the service), which corresponds to isLocal in the code, instead of passing "data" as a parameter to settings.success(), you would need to pass an slice (page) of the array as an object with the same structure that "data" uses.
I hope this helps.
All the best
You mean the "Using JSDO in Progress OpenEdge Mobile Applications (1000-021) (Rev. 2)" course, chapter about implementing batch read?
I found it just now. I will try to do it...
Thanks for the hint!
Where would I find:
"Using JSDO in Progress OpenEdge Mobile Applications (1000-021) (Rev. 2)"
Thanks in advance.
This is part of the Progress Training Catalog for OE (wbt.progress.com) and you need a subscription to access it. I've looked at it and it describes/explains the implementation of batching I've forwarded to you long time ago (back and forward with a small set of records). Good thing you have the sample, because the training doesn't seem to have the code that does the batching itself.
ELCB Information Services (Pty) Ltd
Customer Service Email
E A S T
L O N D O N
Fax: +27(43) 704 0701
J O H A N N E S B U R G
Tel: +27(11) 879 6179
Fax: +27(11) 454 0384
P O R T E L I Z A B E T H
Tel: +27(41) 373 0529
Fax: +27(86) 650 0135
This is part of the Progress Training Catalog for OE (wbt.progress.com) and you need a subscription to access it. I've looked at it and it describes/explains the implementation of batching I've
forwarded to you long time ago (back and forward with a small set of records). Good thing you have the sample, because the training doesn't seem to have the code that does the batching itself.
this post as spam/abuse.