The calendar of an app whose events the server reads – from a
database, a folder, a computation – as toastui's calendarOutput() and
renderCalendar(): the page holds el_calendar_output(), the server
renders el_calendar() into it with its events. Rendering again with
new events patches the calendar in place: the month shown and an open
dialog stay, and only what changed is sent.
Usage
el_calendar_output(outputId, width = "100%", loading = TRUE)
render_el_calendar(expr, env = parent.frame(), quoted = FALSE)Arguments
- outputId
The output's id.
- width
The calendar's width, as a CSS unit.
- loading
Whether Element's loading mask covers the calendar while Shiny recalculates it, in place of Shiny fading the output.
- expr
An expression returning
el_calendar(), given noid.- env, quoted
As for
shiny::renderUI().
Details
The output's id is the calendar's: input$<id> is the day picked and
input$<id>_click, _dates, _add, _update, _delete are as for
el_calendar(); update_el_calendar() reaches the calendar by it, and
el_calendar_events() reads the events it shows.
Examples
if (interactive()) {
library(shiny)
archive <- data.frame(
date = Sys.Date() - c(9, 6, 2),
title = c("", "", "Validated"),
body = c("Raw data", "Archive", "Validated data"),
color = c("lightgrey", "#EED5B7", "#E9C46B")
)
ui <- el_page(el_calendar_output("snapshot"), verbatimTextOutput("picked"))
server <- function(input, output, session) {
output$snapshot <- render_el_calendar(
el_calendar(value = max(archive$date), events = archive)
)
output$picked <- renderPrint(input$snapshot_click$date)
}
shinyApp(ui, server)
}