shinyStore | R package that adds HTML5 Local Storage support to Shiny | Storage library
kandi X-RAY | shinyStore Summary
kandi X-RAY | shinyStore Summary
The shinyStore package enables Shiny application developers to take advantage of HTML5 Local Storage to store persistent, synchronized data in the user’s browser.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of shinyStore
shinyStore Key Features
shinyStore Examples and Code Snippets
Community Discussions
Trending Discussions on shinyStore
QUESTION
The documentation of selectizeInput
describes the argument selected
as follows.
selected The initially selected value (or multiple values if multiple = TRUE). If not specified then defaults to the first value for single-select lists and no values for multiple select lists.
I interpreted this sentence as the selected
argument would be the first element of the choices
argument if nothing is specified for the selected
. However, in the following example, after the selection of any numbers for the first selectizeInput
, the second selectizeInput
does not select the first choice. It still displays the default message as a placeholder.
Notice that if I set server = TRUE
, the second selectizeInput
would be able to display the first choice as the selected
.
I am wondering why server = TRUE
or server = FALSE
affects if the selected
can be the first element in choices
. I also want to know how I can make the behavior of server = FALSE
as the same as when server = TRUE
.
ANSWER
Answered 2021-Jul-08 at 05:14Why not create the second selectizeInput
completely on the server side?
QUESTION
In this example (https://yuchenw.shinyapps.io/shinystore_de/), I have designed a simple app with two selectizeInput
. The choices of the second selectizeInput
depends on the selected results of the first selectizeInput
. My goal is to design an app that uses the shinyStore
package (https://github.com/trestletech/shinyStore) to save the selected values using the local storage. Next time when users open the app using the same web browser, I hope the values remain.
However, the current is not working. In the following example, I first selected 2
for the first selectizeInput
, and then selected f
for the second selectizeInput
.
I then clicked the Save
button, copied the URL, and pasted it in a new web browser. The selected values for the first selectizeInput
is 2
as expected, but the selectizeInput
did not show f
.
My guess is I used updateSelectizeInput
twice for the second selectizeInput
, which leads to confusion. Please see my code as follows and let me know if you have any insights.
Update
Here is a follow-up question (shinyStore cannot restore the selected values of the selectizeInput if the choices are depends on another input and server = TRUE) I asked, which uses server = TRUE
for the updateSelectizeInput
and the same strategy is not working.
ANSWER
Answered 2021-Jul-07 at 16:58The following modification of the server
script seems to work. I used a separate observe
call for the two selectizeInput
.
QUESTION
I have designed a Shiny app with two action buttons, Save
and Clear
. When users click Save
, the input values will be stored using local storage of the web browser. When users click Clear
, the inputs and local storage would be cleaned.
These functionalities involves updating multiple inputs with update...Input
. In this example, I have three inputs all with different widget types. I can specifically write them one by one, which works fine. However, I am wondering if there is a more efficient way to achieve this, such as using for loop
or lapply
. From this post (https://stackoverflow.com/a/41061114/7669809), it seems like I can use reactiveValuesToList
to get all inputs. The real challenge to me is how to dynamically call different update...Input
functions for the associated input widget types?
Please let me know if you have any suggestions.
...ANSWER
Answered 2021-Jun-25 at 00:56Unfortunately there is no generic updateInput
function in shiny
. It is still possible to build a wrapper that identifies a certain name to a certain input type, but that will also require to know which argument is allowed or no. For example, updateActionButton
doesn't have value
or choices
as an argument so we'll need numerous if statements.
A possible workaround is to take advantage of renderUI
and directly pass the stored values. The only downside is that some functions like SliderInput
throw an error when some arguments are NULL, so an if statement is needed to appoint a default value for the first time the app runs. Alternatively a mock app can be executed once to only fill the first values.
Code:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install shinyStore
A simple example to demonstrate the usage of the shinyStore package. An example demonstrating the use of encrypted storage to secure the data you’re writing to the user’s browser. See the <a href ="#security">security section</a> for more details.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page