E
egarcia
Guest
Hello, 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. There is a way that you can do it today but you would need to change the JSDORead [Service] code (you can see it in the JavaScript section) so that you the mapping to the list would use a subset of records from the JSDO rather than number. 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.
Continue reading...
Continue reading...