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

No file extension when using askForWriterType #61

Closed
1 of 3 tasks
ghost opened this issue Aug 19, 2019 · 2 comments
Closed
1 of 3 tasks

No file extension when using askForWriterType #61

ghost opened this issue Aug 19, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 19, 2019

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laravel Excel.
  • Checked that your issue isn't already filed.
  • Checked if no PR was submitted that fixes this problem.

Versions

  • PHP version: 7.1.3
  • Laravel version: 5.8
  • Nova version: 2.0
  • Package version: Laravel Excel: 3.1, Laravel Nova Excel: 1.1

Description

I have the following in my actions() function:

return [
    (new DownloadExcel())
        ->withFilename('documents')
        ->askForWriterType([
            Excel::XLSX => 'XLSX',
            Excel::CSV  => 'CSV',
            Excel::HTML  => 'HTML',
        ])
];

Instead of getting the filename I set within withFilename function followed by the extesion I selected in the dropdown menu, I get only documents without any extesion.

This is happening only when askForWriterType is used in combination with withFilename function.

I have seen in the documentation that when using withFilename, I should specify the file extension within the function parameter, like withFilename('documents.html'), but the file type beeing dynamic, how I can get what file type the user selected within the dropdown menu?

Steps to Reproduce

Just add the above code in your Nova component.

Expected behavior:

The name of the file I want to download should be documents. followed by the extesion I selected in the dropdown list. For example, if I select html, I should get documents.html.

Actual behavior:

Instead of getting the filename I set within withFilename function followed by the extesion I selected in the dropdown menu, I get only documents without any extesion.

@patrickbrouwers
Copy link
Member

That's indeed currently not supported. Feel free to make a PR to add this.

patrickbrouwers added a commit that referenced this issue Oct 8, 2020
#61 Add extension to filename when using withFilename()
@patrickbrouwers
Copy link
Member

PR merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant