Pagination with multiple Data Sources

Pagination with multiple Data Sources

nickp64nickp64 Posts: 1Questions: 0Answers: 0

Hello,

My apologies in advance if this question has been asked before but I simply couldn't find anything helpful so this is the reason I'm asking it here.

I am using DataTables to display a table of results from a search performed by the user. The user can select multiple data sources to search from and sends their request to the backend. The backend knows how to send its requests to each of these data sources. I'm using serverSide + processing to paginate the search results.

The user may select how many results per page the table should display. The sent request contains the number of the first record and the last record to fetch for this page. If I leave the last record number to be the page size for all data source results and the user searches against 3 data sources for example, then the table would have 3 times the rows the user wanted to have displayed on a single page. Another idea is to split approximately equally the number of records returned from each data source to fill the results per page, by doing page size / the number of data sources that the user is searching against. E.g. if user wants to see 20 results per page from 3 data sources, they should get 7 from data source A, 7 from B and 6 from C. However, if one of them does not return results, fewer than 20 would be displayed on each page and we might have to avoid that.

I would love to hear your advices for a correct approach to this problem.

This discussion has been closed.