Closed JesusPF1981 closed 3 years ago
I have created an App that generates 3 plots, when user click on Add plot (using insertUI).
If you try to Add one plot and resize it, if you want to bookmark the app, the size and position are not correctly saved.
Im using the last shinyjqui version with R 3.3 and R 3.5 also in windows and linux, but noone works
library(shiny) library(shinyjqui)
ui <- function(request) { fluidPage( bookmarkButton(), sidebarLayout( actionButton("add", "Add Element"), mainPanel(id = "content") ) ) }
server <- function(input, output, session) {
addItem <- function(id) { insertUI( selector = "#content", where = "beforeEnd", ui = tagList( jqui_resizable(plotOutput(id)) ) ) }
observeEvent(input$add, { id <- paste0("plot", input$add) addItem(id) })
output$plot1 <- renderPlot( plot(c(3,2,2)) )
onRestore(function(state) { for (i in seq_len(input$add)) { id <- paste0("plot", i) addItem(id) } }) jqui_bookmarking() }
enableBookmarking("url") shinyApp(ui, server)
Thanks Jesús
The code should work now with the bug fixing 9bbaab7ecedc9d384ff296107e78210893b21a38
I have created an App that generates 3 plots, when user click on Add plot (using insertUI).
If you try to Add one plot and resize it, if you want to bookmark the app, the size and position are not correctly saved.
Im using the last shinyjqui version with R 3.3 and R 3.5 also in windows and linux, but noone works
Here is my app:
library(shiny) library(shinyjqui)
ui <- function(request) { fluidPage( bookmarkButton(), sidebarLayout( actionButton("add", "Add Element"), mainPanel(id = "content") ) ) }
server <- function(input, output, session) {
addItem <- function(id) { insertUI( selector = "#content", where = "beforeEnd", ui = tagList( jqui_resizable(plotOutput(id)) ) ) }
observeEvent(input$add, { id <- paste0("plot", input$add) addItem(id) })
output$plot1 <- renderPlot( plot(c(3,2,2)) )
onRestore(function(state) { for (i in seq_len(input$add)) { id <- paste0("plot", i) addItem(id) } }) jqui_bookmarking() }
enableBookmarking("url") shinyApp(ui, server)
Thanks Jesús