View source: R/selectableTableOutput.R
selectableTableOutput | R Documentation |
Render a standard HTML table with its rows or cells selectable. The server
will receive the index of selected rows or cells stored in
input$<outputId>_selected
.
selectableTableOutput(outputId, selection_mode = c("row", "cell"))
outputId |
output variable to read the table from |
selection_mode |
one of |
Use mouse click to select single target, lasso (mouse dragging) to select
multiple targets, and Ctrl + click to add or remove selection. In row
selection mode, input$<outputId>_selected
will receive the selected row
index in the form of numeric vector. In cell
selection mode,
input$<outputId>_selected
will receive a dataframe with rows
and
columns
index of each selected cells.
A table output element that can be included in a panel
shiny::tableOutput, sortableTableOutput
## Only run this example in interactive R sessions
if (interactive()) {
shinyApp(
ui = fluidPage(
verbatimTextOutput("selected"),
selectableTableOutput("tbl")
),
server = function(input, output) {
output$selected <- renderPrint({input$tbl_selected})
output$tbl <- renderTable(mtcars, rownames = TRUE)
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.