Infinite scrolling and dynamic filters
In the last section of this chapter, let's bring together our two main topics – pagination and dynamic queries. Earlier, in the Implementing infinite scroll section, we implemented infinite scrolling for the ORDERDETAIL
table. Now, let's add some filters for ORDERDETAIL
that allows a client to choose the price and quantity ordered range, as shown in this figure:
We can easily implement this behavior by fusing the powers of SEEK
and SelectQuery
:
public List<Orderdetail> fetchOrderdetailPageAsc( long orderdetailId, int size, BigDecimal priceEach, Integer quantityOrdered) { SelectQuery sq = ctx.selectFrom(ORDERDETAIL) .orderBy(ORDERDETAIL.ORDERDETAIL_ID) .seek(orderdetailId) .limit...