Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions inst/themer-demo/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ if (isTRUE(IS_LEGACY)) {
theme_set(theme_minimal())
}

bs_table <- function(x, class = NULL, ...) {
class <- paste(c("table", class), collapse = " ")
class <- sprintf('class="%s"', class)
HTML(knitr::kable(x, format = "html", table.attr = class))
}

shinyApp(
page_navbar(
theme = theme,
Expand Down Expand Up @@ -159,7 +165,22 @@ shinyApp(
),
nav_panel(
"Tables",
DT::dataTableOutput("DT")
tabsetPanel(
id = "tables",
tab(
"DataTables",
DT::dataTableOutput("DT")
),
tab(
"Bootstrap",
h3("Plain tables", class = "mt-2 mb-1"),
bs_table(mtcars[1:5, 1:5]),
h3("Striped tables", class = "mt-4 mb-1"),
bs_table(mtcars[1:5, 1:5], class = "table-striped"),
h3("Striped tables with hover", class = "mt-4 mb-1"),
bs_table(mtcars[1:5, 1:5], class = "table-striped table-hover")
)
)
),
nav_panel(
"Notifications",
Expand Down Expand Up @@ -247,7 +268,17 @@ shinyApp(
function(input, output, session) {

output$DT <- DT::renderDataTable({
DT::datatable(mtcars, style = "bootstrap4")
cars <- mtcars
for (var in c("cyl", "vs", "am", "gear", "carb")) {
cars[[var]] <- factor(cars[[var]])
}

DT::datatable(
cars,
style = "auto",
caption = "A generic table made with the DT package and the DataTables library.",
filter = "top"
)
})

output$inputPanelOutputHeader <- renderText({
Expand Down