#' setup
#'
#' @importFrom shinyalert useShinyalert
setup <- function() {
useShinyalert()
}
#' render_expected_table
#'
#' @param table table to render
#' @param pageLength page length. Default to 5
#'
#' @importFrom DT renderDT datatable formatStyle
#' @importFrom magrittr %>%
render_expected_table <- function(table, pageLength = 5) {
renderDT({
datatable(
table,
rownames = TRUE,
escape = TRUE,
selection = 'none',
options = list(
searchHighlight = TRUE,
scrollX = TRUE,
fixedHeader = TRUE,
pageLength = pageLength,
dom = ifelse(nrow(table) > 5, 'Brtp', 'Brt')
)
) %>% formatStyle(
names(table),
target = 'row',
backgroundColor = '#edf2f6'
)
})
}
# render_expected_tables <- function(output, data, pageLength = 5) {
# lapply(names(data), function(x) {
# output[[x]] = render_expected_table(data[[x]], pageLength)
# })
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.