Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create vignette to explain how to update a rank list #67

Closed
andrie opened this issue Oct 13, 2020 · 0 comments
Closed

Create vignette to explain how to update a rank list #67

andrie opened this issue Oct 13, 2020 · 0 comments
Assignees

Comments

@andrie
Copy link
Member

andrie commented Oct 13, 2020

Based on an idea by @tyluRp in #66

library(shiny)

ui <- fluidPage(
  selectInput("data", "data", c("mtcars", "iris"), "mtcars"),
  uiOutput("sortable"),
  tableOutput("table")
)

server <- function(input, output, session) {
  rv <- reactiveValues(data = data.frame())
  
  observeEvent(input$data, {
    rv$data <- get(input$data)
  })
  
  observeEvent(input$sortable, {
    rv$data <- rv$data[input$sortable]
  })
  
  output$sortable <- renderUI({
    sortable::rank_list("", names(rv$data), "sortable")
  })
  
  output$table <- renderTable({
    rv$data
  })
}

shinyApp(ui, server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant