proxy-navigate: Navigate into a calendar with Proxy

Description Usage Arguments Examples

Description

Those functions allow to navigate in the calendar from the server in a Shiny application.

Usage

1
2
3
4
5
6
7

Arguments

proxy

A calendarProxy htmlwidget object.

date

A specific date to navigate to.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (interactive()) {
  library(shiny)
  
  ui <- fluidPage(
    tags$h2("Navigate in calendar with actionButtons"),
    actionButton(
      inputId = "prev", 
      label = "Previous"
    ),
    actionButton(
      inputId = "next_", 
      label = "Next"
    ),
    actionButton(
      inputId = "today", 
      label = "Today"
    ),
    calendarOutput(outputId = "my_calendar")
  )
  
  server <- function(input, output, session) {
    
    output$my_calendar <- renderCalendar({
      calendar(defaultView = "month", useNav = FALSE)
    })
    
    observeEvent(input$prev, cal_proxy_prev("my_calendar"))
    observeEvent(input$next_, cal_proxy_next("my_calendar"))
    observeEvent(input$today, cal_proxy_today("my_calendar"))
    
  }
  
  shinyApp(ui, server)
}

dreamRs/tuicalendr documentation built on Aug. 4, 2021, 12:02 a.m.