| datagrid-shiny | R Documentation |
datagrid()Output and render functions for using datagrid() within Shiny
applications and interactive Rmd documents.
datagridOutput(outputId, width = "100%", height = "400px")
renderDatagrid(expr, env = parent.frame(), quoted = FALSE)
renderDatagrid2(expr, env = parent.frame(), quoted = FALSE)
datagridOutput2(outputId, width = "100%", height = "auto")
outputId |
Output variable to read from. |
width, height |
Must be a valid CSS unit (like |
expr |
An expression that generates a calendar |
env |
The environment in which to evaluate |
quoted |
Is |
Output element that can be included in UI. Render function to create output in server.
The following input values will be accessible in the server:
input$outputId_data : contain the data displayed in grid, only available when datagrid(data_as_input = TRUE) or when using grid_editor()
input$outputId_data_filtered : contain the filtered data displayed in grid, only available when datagrid(data_as_input = TRUE) or when using grid_editor()
input$outputId_validation : contain results of validation rules applied to data, only available when using validation argument in grid_editor()
input$outputId_data and input$outputId_data_filtered have an attribute "event"
indicating what triggered the update of the input, retrieve it with attr(input$outputId_data, "event"):
"init": the grid has been rendered (or re-rendered).
"edit": data has been edited by the user in the grid (see grid_editor()).
"sort" / "filter": the grid has been sorted / filtered (or sort / filter removed).
"drop": a row has been moved with drag and drop (datagrid(draggable = TRUE)).
"proxy-add-rows", "proxy-delete-rows", ...: data has been modified from the server with a proxy method (e.g. grid_proxy_add_row()).
These other inputs can be defined using other functions:
row selection: giving row selected with checkboxes or radio buttons in inputId defined in grid_selection_row()
cell selection: giving cell selected with mouse in inputId defined in grid_selection_cell()
cell clicked: giving row index and column name of cell clicked in inputId defined in grid_click()
library(shiny)
library(toastui)
ui <- fluidPage(
tags$h2("datagrid shiny example"),
tabsetPanel(
tabPanel(
title = "Fixed height",
datagridOutput("default"),
tags$b("CHECK HEIGHT")
),
tabPanel(
title = "Full height",
datagridOutput("fullheight", height = "auto"),
tags$b("CHECK HEIGHT")
),
tabPanel(
title = "Pagination",
datagridOutput("pagination", height = "auto"),
tags$b("CHECK HEIGHT")
)
)
)
server <- function(input, output, session) {
output$default <- renderDatagrid({
datagrid(rolling_stones_500)
})
output$fullheight <- renderDatagrid({
datagrid(rolling_stones_500, bodyHeight = "auto")
})
output$pagination <- renderDatagrid({
datagrid(rolling_stones_500, pagination = 15)
})
}
if (interactive())
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.