selectableTableOutput: Create a table output element with selectable rows or cells

Description Usage Arguments Details Value See Also Examples

View source: R/selectableTableOutput.R

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

1
selectableTableOutput(outputId, selection_mode = c("row", "cell"))

Arguments

outputId

output variable to read the table from

selection_mode

one of "row" or "cell" to define either entire row or individual cell can be selected.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)
    }
  )
}

shinyjqui documentation built on Feb. 3, 2022, 9:06 a.m.