update feedback error
Closed this issue · 1 comments
nara3m commented
goal: depending on the input number (if else loop), different feedback message should be displayed. Possible duplicate of #55
error: after input change, feedback message is not updated
min working example to reproduce error: below.
library(shiny)
library(shinyFeedback)
# Module ui.R
expt.design.ui <- function(id) {
ns <- NS(id)
tagList(
useShinyFeedback(),
numericInput(ns("numSamples"), "How many samples in this experiment ?", value = 12)
)
}
# Module server.R
expt.design.server <- function(input, output, session) {
observeEvent(input$numSamples, {
req(input$numSamples)
if(is.numeric(input$numSamples)){
if (input$numSamples > 100) {
showFeedbackDanger(inputId = "numSamples", text = "too many..")
} else if(input$numSamples <= 4) {
showFeedbackWarning(inputId = "numSamples", text = "too less!")
} else if(input$numSamples <= 100) {
showFeedbackSuccess(inputId = "numSamples", text = "all good!")
} else {
hideFeedback("numSamples")
}
} else {
showFeedbackDanger(inputId = "numSamples", text = "should be number!")
}
})
}
ui <- fluidPage(
expt.design.ui(id = "numberFoo")
)
server <- function(input, output) {
callModule(module = expt.design.server, id = "numberFoo")
}
shinyApp(ui, server)
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] shinyFeedback_0.4.0 svglite_2.1.0 metap_1.8
[4] cowplot_1.1.1 gridExtra_2.3 broom_0.7.12
[7] Cairo_1.5-14 DT_0.20 shinycssloaders_1.0.0
[10] ggalluvial_0.12.3 forcats_0.5.1 dplyr_1.0.8
[13] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0
[16] tibble_3.1.6 tidyverse_1.3.1 shinydashboard_0.7.2
[19] outliers_0.14 readxl_1.3.1 ggforce_0.3.3
[22] Factoshiny_2.4 FactoInvestigate_1.7 FactoMineR_2.4
[25] ggpubr_0.4.0 rstatix_0.7.0 ggpmisc_0.4.5
[28] ggpp_0.4.3 reshape2_1.4.4 RColorBrewer_1.1-2
[31] pheatmap_1.0.12 ggrepel_0.9.1 magrittr_2.0.2
[34] stringr_1.4.0 qvalue_2.22.0 limma_3.46.0
[37] xlsx_0.6.5 auth0_0.2.1 ggplot2_3.3.5
[40] bs4Dash_2.0.3 shiny_1.7.1 `