Is it possible to save and restore selections of a shinyTree?
I found a solution deleting the selections R Shiny - Updating shinyTree node selections
but I need to save the selections and restore them later for example, by an actionButton
Is it possible to save and restore selections of a shinyTree?
I found a solution deleting the selections R Shiny - Updating shinyTree node selections
but I need to save the selections and restore them later for example, by an actionButton
Copyright © 2021 Jogjafile Inc.
This is not possible with
shinyTreeonly. Some functions of the underlyingjsTreelibrary have to be called directly and the values passed from JavaScript to R and vice-versa.I made a small example, which should help you as a starting point.
If you save a selection via button-click, R sends a custom message to JavaScript, which will get the selected IDs and returns it to R via
Shiny.setInputValue.The selected ID's are then saved in the reactiveValues
selectionRV, but you could save them in a file or database if needed.