F
Filament8mo ago
Hugo

Send variables to the Exporter

I've got a resource with a table. I have a history table action which opens up a modal with several tabs with tables (several types of history from the selected record) inside. In the header of each table I wan't to add an ExportAction but i'd like to send through some variables (like the selected $record from the first table) so that I can have a column on the exporter just for that variable (yes the column will always have the same value). To give you proper context. You have a piece of clothing. You want to see the washing history that happened on that piece of clothing. Each washing process saves in a json column all the clothes it washed. To see through the history of a certain clothing, im retrieving all washing processes, getting all the articles it washed and compare them with the clothing $record i selected and then saving every washing process id. Then on the table im just showing the washing processes which id I saved. So the clothing piece has no direct relationship with the washing process. How can I send the $record variable (which is my clothign piece) to the exporter so that I can have a column with that information to export?
6 Replies
bwurtz999
bwurtz9998mo ago
You could try creating a custom public variable on the page, something like public $clothingId, and then when the user clicks on that piece of clothing to bring up the modal/tables you also set the $clothingId to the correct value. Then if you're calling an export function you can reference $this->clothingId
Hugo
HugoOP8mo ago
Can i access it inside the Exporter tho?
toeknee
toeknee8mo ago
So this has been discussed in here and I / Dan updated the docs on how to handle that I’m sure
Hugo
HugoOP8mo ago
Couldn't find it. Could you link me the docs? Sorry for the delayed response.
Hugo
HugoOP8mo ago
Thank you, it worked. Since there was no info on the Export Action docs, I thought it wasn't possible.
Want results from more Discord servers?
Add your server