-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
I have a problem connecting N destinations with M origins, and both are dynamically created in my shiny app. After completion, the user must drag from the first list to one of N destinations, and then the results are stored. Also, when the app is initialized, I should be able to restore the way it was.
Below is an example of how I am creating this N x M, but I need help restoring the way it was.
Is it in the roadmap that allows adding many lists dynamically and also updating those rank lists?
Thank you very much
library(shiny)
library(sortable)
ui <- fluidPage(
fluidRow(
style = "display: flex; flex-direction: row; justify-content: space-around; margin: 27px;",
numericInput("generate_n", "Generate N lists", 2),
numericInput("generate_m", "Generate M items", 3)
),
uiOutput("dragAndDropList")
)
server <- function(input, output) {
output$dragAndDropList <- shiny::renderUI({
req(input$generate_n, input$generate_m)
list_n <- 1:input$generate_n
list_m <- 1:input$generate_m
p <- paste0('sortable::bucket_list(
header = "Dynamic bucket list",
group_name = "dynamic_group",
orientation = "horizontal",
sortable::add_rank_list(
text = "Items to distribute",
labels = as.character(list_n),
input_id = "items"
),
${dynamic_rank}
)')
ll <- purrr::map(list_m, function(.x) {
paste0('sortable::add_rank_list(text = "', .x, '", labels = NULL, input_id = paste0("list", ', .x, "))")
})
dynamic_rank <- paste0(ll, collapse = ",")
eval(parse(text = stringr::str_interp(p)))
})
}
shinyApp(ui, server)
Metadata
Metadata
Assignees
Labels
No labels