Searching through pagination

Hi everyone,

I have 300 rows of hospital names, paginated into 60 pages of 5 on the back end.

Each row also has the name of the city the hospital is in.

I have added a search bar to the table on weweb, so users can search, for example, “New York”, and only see hospitals in New York.

But, when I search a city name, it only shows results for hospitals that are on the same page.

So if there are 30 hospitals in New York, spread across 50 pages, it will only show, say the 1 or 2 that are on the current page the paginator is set to.

Is there a way to have the search go across all pages, and narrow down all hospitals that are in that city, not just those on the current page the paginator is sent to?

if you do the filtering on the frontend you can only filter in the data you have available, a single page in this case. you need to do the search on the backend so you will get the filtered result paginated.

Hi Dorilama, I am doing the pagination on the backend

yes, but you need to do the filtering on the backend as well, otherwise you have the problem you described

thanks

1 Like