How to paginate using column values and order-by clause?

8 views
Skip to first unread message

Baskaran S

unread,
Nov 1, 2021, 5:43:36 PM11/1/21
to Lift
Hello Lifters,

I am learning Lift. Today, I CRUDified my first relational table using Mapper interface. Out of the box, Lift 3.5.0 is allowing me to view, edit and delete rows in the table, and Lift is paginating the table for free, it is amazing.

In Lift 3.5.0, pages are fetched from the database using OFFSET and LIMIT clauses, this is good for small to medium tables, but may slowdown while stepping thru large tables or large views with join conditions.

Is there a way to paginate a table using a column, like CUSTOMER_ID?

For example:
    SELECT *
    FROM   CUSTOMER
    WHERE  CUSTOMER_ID > ?
    LIMIT  20;

Where, CUSTOMER_ID will not be displayed in the browser, but it will be stored in the lift session for fetching the next page from the database.

I searched the forum, but no luck.  Can you direct me to a page or give me some pointers to implement "pagination by column value"? Thank you in advance.

Finally, my aim is to paginate over a result set that is ordered by RANK descending and ID ascending. Where, RANK is a float and ID is a unique key.

thanks and regards
S. Baskaran
Reply all
Reply to author
Forward
0 new messages