downloadableTable: downloadableTable Module

Description Usage Arguments Value Notes Shiny Usage See Also Examples

View source: R/downloadableTable.R

Description

Server-side function for the downloadableTableUI. This is a custom high-functionality table paired with a linked downloadFile button.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
downloadableTable(
  input,
  output,
  session,
  logger,
  filenameroot,
  downloaddatafxns = list(),
  tabledata,
  rownames = TRUE,
  caption = NULL,
  selection = NULL
)

Arguments

input

provided by shiny::callModule

output

provided by shiny::callModule

session

provided by shiny::callModule

logger

logger to use

filenameroot

the base text used for user-downloaded file - can be either a character string or a reactive expression returning a character string

downloaddatafxns

a named list of functions providing the data as return values. The names for the list should be the same names that were used when the table UI was created.

tabledata

function or reactive expression providing the table display data as a return value. This function should require no input parameters.

rownames

whether or not to show the rownames in the table

caption

table caption

selection

function or reactive expression providing the row_ids of the rows that should be selected.

Value

Reactive expression containing the currently selected rows in the display table

Notes

When there are no rows to download in any of the linked downloaddatafxns the button will be hidden as there is nothing to download.

Shiny Usage

This function is not called directly by consumers - it is accessed in server.R using the same id provided in downloadableTableUI:

callModule(downloadableTable, id, logger, filenameroot, downloaddatafxns, tabledata, rownames, caption, selection)

Note: callModule returns the reactive expression containing the currently selected rows in the display table.

See Also

downloadableTableUI

callModule

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Inside server_local.R

# selectedrows <- callModule(downloadableTable, 
#                            "object_id1", 
#                            logger = ss_userAction.Log,
#                            filenameroot = "mydownload1",
#                            downloaddatafxns = list(csv = mydatafxn1, tsv = mydatafxn2),
#                            tabledata = mydatafxn3,
#                            rownames = FALSE,
#                            caption = "This is a great table!  By: Me",
#                            selection = mydataRowIds)

# selectedrows is the reactive return value, captured for later use

periscope documentation built on July 8, 2020, 7:18 p.m.