Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
Toastui calendar in shiny: change background color of the calendar for specific days

I am trying to change the background color of specific days in a toastui calendar in shiny. I tryed to use javascript to do it but didn't work.

library(shiny)
library(toastui)

options(shiny.launch.browser = T)

ui <- fluidPage(
  
  tags$script(
    HTML(
      "var x = [1,3,5,6]; 
      x.map((n,i) => document.querySelectorAll('.tui-full-calendar-weekday-grid-line.tui-full-calendar-near-month-day').item(n).style.backgroundColor = '#00ff004c');"
      
    )
  ),
  calendarOutput("my_calendar")
)

server <- function(input, output) {
  
  output$my_calendar <- renderCalendar({
    calendar(
      defaultDate = Sys.Date(),
      useNavigation = TRUE
    )
  })
}

if (interactive())
  shinyApp(ui = ui, server = server)

I run the javascrip in browser console and there it works. The image shows what I want.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I got what i wanted using shinyjs and observing _dates

library(shiny)
library(toastui)
library(shinyjs)

options(shiny.launch.browser = T)

ui <- fluidPage(
  shinyjs::useShinyjs(),
  calendarOutput("my_calendar")
)

server <- function(input, output) {
  
  output$my_calendar <- renderCalendar({
    calendar(
      defaultDate = Sys.Date(),
      useNavigation = TRUE
    )
  })
  
  observeEvent(input$my_calendar_dates, {
    
    shinyjs::runjs("
                   
                   var x = [1,3,5,6]; 
                   x.map((n,i) => document.querySelectorAll('.tui-full-calendar-weekday-grid-line.tui-full-calendar-near-month-day').item(n).style.backgroundColor = '#00ff004c');
                   
                   ")
    
  })
  
}

if (interactive())
  shinyApp(ui = ui, server = server)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda