Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow limiting column map in exports #14853

Open
wants to merge 8 commits into
base: 3.x
Choose a base branch
from

Conversation

ralphjsmit
Copy link
Contributor

@ralphjsmit ralphjsmit commented Nov 20, 2024

Description

This PR adds the option to limit the ExportAction to certain columns. Previously, the only choice we had to limit columns was to have a column mapping form where the user can choose columns. However, sometimes we either want the column mapping form not to show all columns, or to not show a column mapping form and directly export a subset of columns.

This adds a ->columns() method that will allow the user to either:

  • Specify which columns get shown in the column mapping form, if ->columnMapping(true) (default).
  • Specify which subset of columns get outputted in the export without showing a form, if ->columnMapping(false).

Basically the four choices are now:

// Show column mapping form, include all columns
// Show column mapping form, include only specified columns
->columns(['id', 'full_name', 'email'])
// Hide column mapping form, export all columns
->columnMapping(false)
// Hide column mapping form, export specified columns
->columns(['id', 'full_name', 'email'])
->columnMapping(false)

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@ralphjsmit ralphjsmit changed the title feat: allow pre-defined column map in exports feat: allow limiting column map in exports Nov 20, 2024
@zepfietje zepfietje added the enhancement New feature or request label Nov 21, 2024
@zepfietje zepfietje added this to the v3 milestone Nov 21, 2024
@zepfietje
Copy link
Member

Been thinking about this before but didn't find the chance to work on it.
I think this is the missing piece for exports! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants