Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

shiny app, calendar is skipping days when it includes dynamic input #2

Closed
Psqrt opened this issue Mar 23, 2020 · 3 comments
Closed

Comments

@Psqrt
Copy link

Psqrt commented Mar 23, 2020

Hello,

I've encountered a weird behiavior from my calendar when I use it in a Shiny app with dynamic input.

Here's a reprex :

library(shiny)
library(shinyWidgets)
library(tuicalendr)
library(dplyr)


ui <- fluidPage(
    sidebarLayout(
        sidebarPanel(
            pickerInput("filter_id",
                        label = "Filter",
                        selected = "id1",
                        choices = c("id1", "id2")
            )
        ),
        mainPanel(
            calendarOutput("agenda")
        )
    )
)

server <- function(input, output) {
    
    output$agenda <- renderCalendar({
        
        calendarProps <- data.frame(
            id = c("1"), 
            name = c("test"),
            color = c("#000000"), 
            bgColor = c("#fcba03"),
            borderColor = c("#fcba03")
        )
        
        # useless data for example
        df = data.frame("id" = c("id1", "id2"),
                        "calendarId" = rep(1, 2),
                        "title" = rep("title1", 2),
                        "start" = rep(Sys.time(), 2),
                        "end" = rep(Sys.time() + 60 * 60 * 2, 2),
                        "category" = rep("time", 2)
        )
        
        df = df %>% 
            filter(id == input$filter_id)
        
        calendar(defaultView = "week",
                 taskView = F,
                 scheduleView = "time",
                 useNav = T) %>% 
            set_calendars_props_df(calendarProps) %>% 
            add_schedule_df(df)
    })
}

shinyApp(ui = ui, server = server)

When you're in the app, select "id2" in the pickerInput then start navigating between weeks, you will notice that some days are skipped.

Thanks!

@pvictor
Copy link
Member

pvictor commented Mar 23, 2020

Salut,

Thanks for reporting this and for the example 👍 , this should be fixed.

Victor

@Psqrt
Copy link
Author

Psqrt commented Mar 23, 2020

Salut,

Indeed, it's working fine now. Thanks for the fast answer!

@Psqrt Psqrt closed this as completed Mar 23, 2020
@pvictor
Copy link
Member

pvictor commented Mar 23, 2020

Cool!
For the other question please open an issue, for now you cannot add a data.frame, but something like a for loop, but i think I can add a new function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants