I would like to update one of my pickerInput
ui.R
looks like:
library(shiny)
library(gtools)
library(data.table)
library(DT)
library(shinyWidgets)
library(plotly)
# the 'datT2' dataset.
datT2<-fread(paste0('./data/','31122018KRB.csv'),header=TRUE, sep=";",stringsAsFactors = FALSE , encoding="UTF-8")
##
fluidPage(
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
fluidRow(
column(10,
h3("Port"),
selectInput(inputId = 'date',
label = 'Stichtag:',
choices = sort(list.files('./data', full.names = FALSE,
recursive = FALSE))
),
###
selectInput("gesell",
"company:",
choices = c(
sort(unique(as.character(datT2$Gesellschaftsname ))))),
# Konzernbezeichnung
pickerInput(
inputId = "konz",
label = "Emittent:",
choices = c(sort(unique(as.character(datT2$Konzernbezeichnung )))),
selected = sort(unique(as.character(datT2$Konzernbezeichnung ))),
options = list(`actions-box` = TRUE,
`selected-text-format` = paste0("count > ", length(unique(as.character(datT2$Konzernbezeichnung )))-1) ,
`count-selected-text` = "Alle",liveSearch = TRUE,
liveSearchPlaceholder= TRUE),
multiple = T
)
)
)
,width = 3),
###
# Main panel for displaying outputs ----
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Tabelle", DT::dataTableOutput("table")),
tabPanel("Glossar")
)#,
)#End_of_mainPanel
)
)
and my server.R
function(input, output,session) {
#gesell<-renderText({reactiveValues(input$gesell)})
### read the data for the summary
#read the data
dataSum <- reactive({
infile <- input$date
if (is.null(infile)){
return(NULL)
}
dataS<-fread(paste0('./data/',infile),header=TRUE, sep=";")
dataS[is.na(data)]<- 0
})
#read the data for GUI
dataGui <- reactive({
infile <- input$date
if (is.null(infile)){
return(NULL)
}
# upload (read) the file (data)
dataGUI<-fread(paste0('./data/',infile),header=TRUE, sep=";", encoding="UTF-8")
dataGui[is.na(data)]<- 0
dataGUI
#})
observeEvent(input$date, {
#
updatePickerInput(session = session, inputId = "konz",
choices = dataGui$Konzernbezeichnung)
})
})
}
However, it dose not update the konz
. What do I do wrong?
The other important question is: Would it update input$konz
in fact for the use in server.R
or it shows just the update in ui.R
?
the first data set is: 31122018.csv
Gesellschaftsname Konzernbezeichnung Rating
UL LE YB
JX VU OE
RB AD VZ
XO KL QG
QN TP XE
IV UK GD
BV QB WJ
LZ UL WR
YY JC UZ
and the second one 31122019.csv
Gesellschaftsname Konzernbezeichnung Rating
UL LEA YB
JX VUA OE
RB AAAD VZ
XO KL QG
QN TP XE
IV UK GD
BV QB WJ
LZ UL WR
YY JC UZ