selectableTableOutput {shinyjqui} | R Documentation |
Create a table output element with selectable rows or cells
Description
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
.
Usage
selectableTableOutput(outputId, selection_mode = c("row", "cell"))
Arguments
outputId |
output variable to read the table from |
selection_mode |
one of |
Details
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.
Value
A table output element that can be included in a panel
See Also
shiny::tableOutput, sortableTableOutput
Examples
## 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)
}
)
}