View source: R/calendar-proxy.R
cal_proxy_view | R Documentation |
This function allow to change the calendar view from the server in a Shiny application.
cal_proxy_view(proxy, view)
proxy |
A |
view |
The new view for the calendar: "day", "week" or "month". |
A calendar_proxy
object.
Other calendar proxy methods:
cal_proxy_clear()
,
cal_proxy_clear_selection()
,
cal_proxy_options()
,
cal_proxy_toggle()
,
calendar-proxy-navigate
,
calendar-proxy-schedule
,
calendar_proxy()
library(shiny)
ui <- fluidPage(
tags$h2("Change calendar view"),
radioButtons(
inputId = "view",
label = "Change view:",
choices = c("day", "week", "month"),
inline = TRUE
),
calendarOutput(outputId = "my_calendar")
)
server <- function(input, output, session) {
output$my_calendar <- renderCalendar({
calendar(view = "day", scheduleView = "allday") %>%
cal_schedules(
title = "Today planning",
start = Sys.Date(),
end = Sys.Date(),
category = "allday"
)
})
observeEvent(
input$view,
cal_proxy_view("my_calendar", input$view),
ignoreInit = TRUE
)
}
if (interactive())
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.