• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pagination livecloud
#1
I did not find in the documentation. how to use pagination.

I only found the cdblist function
https://docs.livecloud.io/List/

what if I have 1000 or 10000 data records. 
whether it can make the application damaged?

how to implement pagination in livecloud?
  Reply
#2
Hi Miyaa,

The different methods to paginate data depends on the data view you plan to use.

Take LiveCloud Manager, for example. This program shows every record in your database. It does not download every record for display. Instead, it downloads a range of records that we use to paginate the data in our table view.

Let's review this at a very high level. I will post some code after each explanation.

We start with getting all the recordIDs for the selected table using cdb_list(). We store the line delimited list in an index variable.

Code:
put cdb_list(xTableID,"cloud") into tIndexA["recordIDs"]


From here, we have a complete list of all the recordIDs. We can calculate how many records we want to cache locally for our view. Figure out how many records will fit into the current size of your view. Also, figure out where you are in your view by checking your scrolled position. These numerical values will allow you to figure out which lines of your index variable to do a cloud read.
Code:
//DETERMINING WHICH ROWS TO SHOW
put the thumbposition of scrollbar "data scrollbar" + 1 into tStart
put min(the number of lines of tIndexA["recordIDs"],the thumbposition of scrollbar "data scrollbar" + the thumbsize of scrollbar "data scrollbar") into tEnd
put line tStart to tEnd + 1 of tIndexA["recordIDs"] into tInputA[gTableID]
split tInputA[gTableID] with lf and empty


Perform your read.

Code:
put cdb_batchRead(tInputA,"cloud") into tOutputA


Display data by repeating through your tOutputA array as needed for your view.

-Mark
  Reply
#3
thanks mark
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)