inst/doc/downloadableTable-module.R

## ----eval=F-------------------------------------------------------------------
# # Inside ui_body.R or ui_sidebar.R
# 
# downloadableTableUI(id            = "object_id1",
#                     downloadtypes = c("csv", "tsv"),
#                     hovertext     = "Download the data here!",
#                     contentHeight = "300px",
#                     singleSelect  = FALSE)

## ----eval = F-----------------------------------------------------------------
# # Inside server_local.R
# sketch <- htmltools::withTags(
#     table(
#         class = "display",
#         thead(
#             tr(
#                 th(rowspan = 2, "Location"),
#                 th(colspan = 2, "Statistics")
#             ),
#             tr(
#                 th("Change"),
#                 th("Increase")
#             )
#         )
#     )
# )
# 
# selectedrows <- downloadableTable(
#     id               = "exampleDT1",
#     logger           = ss_userAction.Log,
#     filenameroot     = "exampletable",
#     downloaddatafxns = list(csv = load_data3, tsv = load_data3),
#     tabledata        = load_data3,
#     colnames         = c("Area", "Delta", "Increase"),
#     filter           = "bottom",
#     callback         = htmlwidgets::JS("table.order([1, 'asc']).draw();"),
#     container        = sketch,
#     formatStyle      = list(columns = c("Total.Population.Change"),
#                             color   = DT::styleInterval(0, c("red", "green"))),
#     formatStyle      = list(columns = c("Natural.Increase"),
#                             backgroundColor = DT::styleInterval(
#                                 c(7614, 15914, 34152),
#                                 c("blue", "lightblue", "#FF7F7F", "red")))
# )
# 
# # NOTE: selectedrows is the reactive return value, captured for later use

## ----eval=F-------------------------------------------------------------------
# library(periscope2)
# 
# app_dir = tempdir()
# create_new_application(name = 'mysampleapp', location = app_dir, sample_app = TRUE)
# runApp(paste(app_dir, 'mysampleapp', sep = .Platform$file.sep))

Try the periscope2 package in your browser

Any scripts or data that you put into this service are public.

periscope2 documentation built on April 15, 2025, 1:24 a.m.