62 lines
1.8 KiB
R
Executable File
62 lines
1.8 KiB
R
Executable File
f_reactable <- function(daten, coldefs = NULL, selection = "single",
|
|
defaultSelected = NULL, hoehe = NULL, highlight_valuta = NULL, filterable = T) {
|
|
reactable(
|
|
daten,
|
|
selection = selection,
|
|
defaultSelected = defaultSelected, # Ermöglicht das Wiederherstellen der Auswahl
|
|
pagination = F,
|
|
defaultPageSize = 17,
|
|
showPageSizeOptions = TRUE,
|
|
defaultSorted = list(valuta = "desc"),
|
|
filterable = filterable,
|
|
highlight = TRUE,
|
|
height = hoehe, # <--- FIXIERT DEN HEADER und macht den Body scrollbar
|
|
bordered = TRUE,
|
|
striped = FALSE,
|
|
compact = TRUE,
|
|
# Styling
|
|
theme = reactableTheme(
|
|
highlightColor = "#e6f7ff", # Etwas dezenter als knallgrün, optional
|
|
# borderColor = "#dfe2e5",
|
|
rowSelectedStyle = list(backgroundColor = "#98F5FF")#
|
|
),
|
|
rowStyle = function(index) {
|
|
style <- list(cursor = "pointer") # immer aktiv
|
|
|
|
if (!is.null(highlight_valuta) &&
|
|
daten$valuta[index] == highlight_valuta) {
|
|
style$background <- "#fff3cd"
|
|
}
|
|
|
|
style
|
|
},
|
|
onClick = "select",
|
|
columns = coldefs
|
|
)
|
|
}
|
|
|
|
f_reactable_sub <- function(daten, coldefs = NULL) {
|
|
reactable(
|
|
daten,
|
|
selection = "single",
|
|
pagination = T,
|
|
defaultPageSize = 17,
|
|
showPageSizeOptions = TRUE,
|
|
filterable = TRUE,
|
|
highlight = TRUE,
|
|
bordered = TRUE,
|
|
striped = FALSE,
|
|
compact = TRUE,
|
|
# Styling
|
|
theme = reactableTheme(
|
|
highlightColor = "#e6f7ff", # Etwas dezenter als knallgrün, optional
|
|
# borderColor = "#dfe2e5",
|
|
rowSelectedStyle = list(backgroundColor = "#98F5FF")#
|
|
),
|
|
rowStyle = function(index) {
|
|
style <- list(cursor = "pointer") # immer aktiv
|
|
},
|
|
onClick = "select",
|
|
columns = coldefs
|
|
)
|
|
} |