Do we have to create exporters for each list having different columns but of the same model?

I have created StudentExporter to export excel file of relation manager table and this table is being used under different resources, where columns with conditions to show on specific resource and hide otherwise. Then if someone wants to export the table, they will get the columns define in exporter. Is there any way we can tell exporter what columns needs to be exported?
Solution:
Sorry for getting back lately! I have used cache to save the visible column names in table ExportAction. Then in the exporter, I have defined all possible export columns. When export job is initiated, it first gets the visible columns from cache, maps them by name, and then filters them to include only those that are marked as visible. The getColumns() function returns the filtered list of columns for export....
Jump to solution
2 Replies
toeknee
toeknee5mo ago
If you store the columns selected in the session for the resource, on the exporter you could check if there is a session selection in session and then only show export columns based on selection 🙂
Solution
UsmanFESF
UsmanFESF5mo ago
Sorry for getting back lately! I have used cache to save the visible column names in table ExportAction. Then in the exporter, I have defined all possible export columns. When export job is initiated, it first gets the visible columns from cache, maps them by name, and then filters them to include only those that are marked as visible. The getColumns() function returns the filtered list of columns for export.

Did you find this page helpful?