Hello everyone,
I would like to introduce myself briefly. I work as a volunteer in an animal breeders' association (I am not paid) and provide support on all IT topics (website, membership fees and also look after the membership database).
The latter was originally maintained via Excel. I replaced it with MS Access a few years ago. I would now like to replace Access for many reasons. A few years ago, I discovered a potential solution with retool, which I would now like to implement in the medium term. I sincerely hope that I can manage this even as a non-programmer. However, I am willing to learn...
Now to my first problem: I want to export the data of a filtered table. As I have read, this can be done via a JavaScript getDisplayData()
see here: Download csv files on filtered table - #6 by Tess
What do I have to enter as an action in the click handler so that I can export the data?
It looks like you're on the right path. If you want the data from the table, you need to adjust the code in your get_displayed_Stammdaten function a little bit. Change it to:
return await table_Stammdaten.getDisplayedData()
Then, the in that "data" input, enter {{ get_displayed_Stammdaten.data }}, which will be the result of your JS query.
@MikeCB Thank you for your solution. If I run the script manually before I start the export, it works great!
But... if I include the whole thing in the button via the event handler, I always have to click on Export twice (!) before I get the updated filtered data.
To understand:
I filter the data e.g. Name: Max Mustermann, click on Export... no (!) file is created.
I filter again: example Julia Meyer and export: I get Max Mustermann... the next click contains Julia.
I assume that the event handlers are processed in parallel and not one after the other. I had already tried to set a debounce in the hope that this would help... But it doesn't seem to help.