click: parse datetime

This commit is contained in:
pvictor 2020-03-17 18:05:41 +01:00
parent b4622aecdb
commit 31ada1a177
3 changed files with 12 additions and 2 deletions

View File

@ -5,7 +5,15 @@
if (is.null(data)) {
NULL
} else {
ununlist(data)
value <- ununlist(data$value)
if (isTRUE(data$datetime)) {
if (is.list(value)) {
value <- rapply(value, to_posix, how = "replace")
} else {
value <- to_posix(value)
}
}
return(value)
}
})
shiny::registerInputHandler("apex_datetime", function(data, ...) {

View File

@ -16,6 +16,8 @@ formatNoSci <- function(x) {
ununlist <- function(x) {
if (is.null(x))
return(x)
n <- names(x)
if (!is.null(n) && all(nzchar(n))) {
lapply(x, ununlist)

View File

@ -61,7 +61,7 @@ HTMLWidgets.widget({
}
Shiny.setInputValue(
x.shinyEvents.click.inputId + ":apex_click",
select
{value: select, datetime: is_datetime(chartContext)}
);
} else {
Shiny.setInputValue(x.shinyEvents.click.inputId, null);