grid_editor_date | R Documentation |
Allow to edit content of columns with a calendar and time picker,
then retrieve value server-side in shiny application with input$<outputId>_data
.
grid_editor_date(
grid,
column,
format = "yyyy-MM-dd",
type = c("date", "month", "year"),
timepicker = c("none", "tab", "normal"),
weekStartDay = NULL,
language = NULL
)
grid |
A table created with |
column |
Column for which to activate the date picker. |
format |
Date format, default is |
type |
Type of selection: date, month or year. |
timepicker |
Add a timepicker. |
weekStartDay |
Start of the week : 'Sun' (default), 'Mon', ..., 'Sat' |
language |
Either |
A datagrid
htmlwidget.
grid_editor
for normal inputs.
library(toastui)
dat <- data.frame(
date = Sys.Date() + 1:10,
date_locale = format(Sys.Date() + 1:10, format = "%d/%m/%Y"),
month = format(Sys.Date() + 1:10, format = "%Y-%m"),
year = format(Sys.Date() + 1:10, format = "%Y"),
time1 = Sys.time() + 1:10,
time2 = Sys.time() + 1:10
)
datagrid(
data = dat,
datepicker_locale = list(
titles = list(
DD = c(
"Dimanche", "Lundi", "Mardi",
"Mercredi", "Jeudi", "Vendredi", "Samedi"
),
D = c("Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"),
MMMM = c(
"Janvier", "F\u00e9vrier", "Mars",
"Avril", "Mai", "Juin", "Juillet",
"Ao\u00fbt", "Septembre", "Octobre",
"Novembre", "D\u00e9cembre"
),
MMM = c(
"Jan", "F\u00e9v", "Mar", "Avr",
"Mai", "Juin", "Juil", "Aou",
"Sept", "Oct", "Nov", "D\u00e9c"
)
),
titleFormat = "MMM yyyy",
todayFormat = "DD dd MMMM yyyy",
date = "Date",
time = "Heure"
)
) %>%
grid_editor_date(
column = "date"
)%>%
grid_editor_date(
column = "date_locale",
format = "dd/MM/yyyy",
language = "custom",
weekStartDay = "Mon"
) %>%
grid_editor_date(
column = "month",
type = "month",
format = "yyyy-MM"
) %>%
grid_editor_date(
column = "year",
type = "year",
format = "yyyy"
) %>%
grid_editor_date(
column = "time1",
timepicker = "tab",
format = "yyyy-MM-dd HH:mm"
) %>%
grid_editor_date(
column = "time2",
timepicker = "normal",
format = "yyyy-MM-dd HH:mm"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.