April 2018
Intermediate to advanced
202 pages
4h 48m
English
Filtering should be done with the help of backend services as well. We can implement this in the same way as we did in Chapter 7, Implementing CRUD User Interfaces. First, the backend service method should accept the filter input. In the example application, the filter value is a String, but in other situations, you may need a custom object containing all the values that can be used for filtering. Here is the new find method, which accepts a filter String:
public static List<Call> find(int offset, int limit, String filter, Map<String, Boolean> sort) { return JPAService.runInTransaction(em -> { Query query = em.createQuery("select c from Call c where lower(c.client) like :filter or c.phoneNumber like :filter or lower(c.city) ...
Read now
Unlock full access