Dynamic Filename Specification for Export Actions
Currently, I leverage the getOptionsFormComponents() method to allow users to customize their export options, such as limiting column content. However, I noticed that while we can access these options in closure functions (like formatStateUsing), there's no direct, built-in method to apply these options to modify the exported file's name dynamically based on user input.
What I'm Looking to Achieve:
I wish to present a text input to users where they can specify a custom filename for their export file before initiating the export process. The goal is to directly use this user-specified filename for the export without resorting to workarounds such as session storage or predefined naming conventions.
Suggestion:
Would it be possible to introduce functionality or a method within the exporter class where $options could directly influence the getFileName method? For example, allowing getFileName to access $options provided through getOptionsFormComponents() would be incredibly beneficial.
Example Use Case:
I also could be overlooking a way to do this with current functionality.
Solution:Jump to solution
Putting this in your own Exporter class seems to do the job & allow users to name their own export files:
```
public function getFileName(Export $export): string
{...
2 Replies
Solution
Putting this in your own Exporter class seems to do the job & allow users to name their own export files:
while that works, what about to modify query/filter by date in the static function modifyQuery()? because we definitely cant inject $options argument nor use $this->options[''] in it.