View source: R/app_module_metadata_server.R
| ie_metadata_server | R Documentation |
Server for a file/analysis selector table (pair with ie_metadata_ui()). It
shows a row-grouped table over an already-aggregated metadata tibble and
pushes the current selection out via set_selected; double-clicking a row
selects just that analysis, double-clicking a file's group header selects all
of its analyses. Most users want the typed wrappers
ie_scans_metadata_server() / ie_cf_metadata_server() / ie_di_metadata_server(),
which bind the right ie_file_server() accessors; ie_metadata_server() itself is
the generic version for wiring a custom metadata source.
ie_metadata_server(
id,
get_metadata,
set_selected = NULL,
get_selection = NULL,
get_select_signal = NULL
)
id |
the module id (must match the paired |
get_metadata |
a reactive returning the metadata tibble to browse (one
row per analysis, with |
set_selected |
optional |
get_selection |
optional reactive of the current selection, used to
reflect it in the table on load (e.g. |
get_select_signal |
optional reactive carrying file paths the table should
exclusively select (e.g. |
a list with the underlying selector-table handle plus the
get_selected_row_id / get_selected_metadata reactives
if (interactive()) {
library(shiny)
iso <-
isoreader2::ir_examples_folder() |>
isoreader2::ir_find_isofiles() |>
isoreader2::ir_read_isofiles()
ui <- ie_metadata_ui("meta")
server <- function(input, output, session) {
file <- ie_file_server("files", get_isofiles = reactive(iso))
# the generic selector wired to any aggregated-metadata accessors; most
# users want the typed wrappers ie_scans_metadata_server() / _cf_ / _di_
ie_metadata_server(
"meta",
get_metadata = file$get_scans_metadata,
set_selected = file$set_selected_scans,
get_selection = file$get_scans_selection
)
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.