# NOT RUN {
## -- example-sortable-js-capture -----------------------------------------
# Simple example of sortable_js_capture.
# Important: set the tags CSS `id` equal to the sortable_js `css_id`
if(interactive()) {
library(shiny)
library(sortable)
ui <- fluidPage(
div(
id = "sortable",
div(id = 1, `data-rank-id` = "HELLO", class = "well", "Hello"),
div(id = 2, `data-rank-id` = "WORLD", class = "well", "world")
),
verbatimTextOutput("chosen"),
sortable_js(
css_id = "sortable",
options = sortable_options(
onSort = sortable_js_capture_input(input_id = "selected")
)
)
)
server <- function(input, output){
output$chosen <- renderPrint(input$selected)
}
shinyApp(ui, server)
}
## ------------------------------------
# For an example, see the Shiny app at
system.file("shiny-examples/drag_vars_to_plot/app.R", package = "sortable")
# }
Run the code above in your browser using DataCamp Workspace