Best way to implement "download" reports feature with pagination
Hi All,
I have a basic CRUD app that has a reporting page allowing users to splice data and print reports based on basic filters (date, customer, transaction type).
My database handles filtering/pagination/search. Pagination needed as browser could be tasked to load 5000-6000 records for a single client if required by user.
What is best way to implement a "Download" feature so that user can download their paginated report in either CSV or PDF? I assume CSV is pretty straightforward as download link can execute a call for all records database serves up in json and app can convert to csv and offer download link. Would that be the same for PDF as well as long as it has pre formatting logic for the PDF?
@lostdreamer_nl is outputadapter just a function i would create in my controller?
ie
public function PaginatedOutputAdapter {
some code that gets paginated results
}
public function CsvOutputAdapter {
some code that gets csv output for download
}
public function PdfOutputAdapter {
some code that gets pdf results
}
If you want you could do it in the controller, it'd be a bit 'better' to separate them into different classes but for small projects it's pretty much ok to create 3 different methods that do the work.