Search code examples
rshinyr-leaflet

selectinput changes but no reaction from the ouput


The code I'm using is:

UI:

   selectInput("var", label = h4("choose a place"), choices =       c("",as.character(Places$Adr)), selected = "", width = "90%")),
    mainPanel(leafletOutput("mymap"),tableOutput("table"))

Server:

output$mymap <- renderLeaflet({
       
      leaflet() %>% addTiles() %>%
        #addCircles(lng = as.numeric(Places$Long), lat = as.numeric(Places$Lat), weight = 1) }

But when I choose an element from the list the output (mymap) doesn't change. Shall I use an observeEvent?


Solution

  • Your UI widget is not being used by your server.

    In UI you named your selectInput with the name "var". To use the value from this widget you need to refer to input$var in your server.