Comments (3)
Hello @KoderKow ,
Thanks for openning the issue. I made some changes in the code to make possible to edit schedules, so please re-install the package with :
remotes::install_github("dreamRs/tuicalendr")
After that you can try the following example where you can create and edit schedules interactively :
library(shiny)
library(tuicalendr)
ui <- fluidPage(
tags$h2("Create and edit schedule"),
fluidRow(
column(
width = 9,
calendarOutput("my_calendar")
),
column(
width = 3,
uiOutput("schedule_update")
)
)
)
server <- function(input, output) {
output$my_calendar <- renderCalendar({
cal <- calendar(
defaultDate = Sys.Date(),
useNav = TRUE,
readOnly = FALSE,
useCreationPopup = TRUE
) %>%
set_month_options(narrowWeekend = TRUE) %>%
add_schedule(
id = "r_intro",
calendarId = "courses",
title = "R - introduction",
body = "What is R?",
start = paste(Sys.Date(), "08:00:00"),
end = paste(Sys.Date(), "12:30:00"),
category = "time"
)
})
output$schedule_update <- renderUI({
if (!is.null(input$my_calendar_update)) {
changes <- input$my_calendar_update$changes
tags$div(
"Schedule",
tags$b(input$my_calendar_update$schedule$id),
"have been updated with:",
tags$ul(
lapply(
seq_along(changes),
function(i) {
tags$li(
tags$b(names(changes)[i], ":"),
changes[[i]]
)
}
)
)
)
}
})
observeEvent(input$my_calendar_add, {
cal_proxy_create(
proxy = "my_calendar",
.list = input$my_calendar_add
)
})
observeEvent(input$my_calendar_update, {
cal_proxy_update(
proxy = "my_calendar",
.list = input$my_calendar_update
)
})
}
# Run the application
shinyApp(ui = ui, server = server)
Careful I changed the name of shiny input generated by the package ! (in example I send you earlier there was an input input$<ID>_schedule_add
now it's just input$<ID>_add
)
I plan to write a vignette to explain usage in shiny apps, but been a little busy. Don't hesitate to open issue, or share what can be better in the package.
Victor
from tuicalendr.
@pvictor Wow thank you so much for doing the updates and for providing an example! This is so cool!
I have it all working on my machine. My last remaining question is what is the most efficient way of presenting the data in either a data table within the shiny app or either saving the new data or rewriting.
I currently have 1000+ schedule entries on a calendar. I tried looking into the different input$...
available but I could not find a way to extract the data from the calendar. I looked at str(cal) and I can see the data. How do I navigate to that?
from tuicalendr.
There's currently no method to retrieve all schedules from calendar, in my mind it was best to add entries when input$my_calendar_add
is triggered, and update entries when input$my_calendar_update
is triggered, like that you control what users add or modify in your calendar.
from tuicalendr.
Related Issues (13)
- html body and altering colour of nav bullets HOT 7
- Option for year view HOT 2
- add `actionButton()` to pop up HOT 4
- Safari compatibility
- dates not getting updated? HOT 2
- shiny app, calendar is skipping days when it includes dynamic input HOT 3
- Unable to delete schedules in edit example HOT 2
- How to select a calendar event HOT 2
- How to enable copy on event popup HOT 2
- Is there a way to search entries using the tuicalendr HOT 2
- Changing weekend days HOT 3
- Adding custom fields to add_schedule_df and edit HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tuicalendr.