滑块在renderui不工作

问题描述:

我有一个闪亮的应用程序是:滑块在renderui不工作

  • 开始与它的一些点单张
  • 允许用户使用的FileInput
  • 地块CSV上加载一个CSV地图LeafletProxy
  • 动态地将滑块从新CSV筛选值

我的问题是,滑盖没有任何电子邮件在地图上运行。它显示得很好,但是当我移动它时,观察和观察事件都没有效果。

我的代码的相关部分

# Create a new map with the data uploaded 
    observe({ 
    if (is.null(newdata())) return(NULL) 
    # Update the map 
    leafletProxy("map", data = newdata()) %>% 
     clearMarkers() %>% 
     addCircles(newdata()$Y, 
       newdata()$X, 
       color = "red") 
    # Add a slider 
    datecol <- newdata()$Date 
    output$setSlider <- renderUI({ 
     if (is.null(newdata())) return(NULL) 
     sliderInput("range", "Dates", 
        min = as.Date(min(datecol)), 
        max = as.Date(max(datecol)),#,"%Y-%m-%d" 
        value = c(as.Date(min(datecol)),as.Date(max(datecol))), 
        timeFormat="%Y-%m-%d") 
    }) 
    }) 

    # Filter the data 
    dataloc <- reactive({ 
    print(input$range) 
    filteredData <- newdata() 
    if(!is.null(input$range)){ 
     filteredData <- filteredData %>% 
     filter(filteredData$Date >= input$range[1], 
       filteredData$Date <= input$range[2]) 
    } 
    return(filteredData) 
    }) 

    observeEvent(input$range,{ 
    filterloc <- dataloc() 
    print("event") 
    if (is.null(newdata())) return(NULL) 
    if (!is.null(dataloc())) return(print(dataloc())) 
     # Update the map 
     leafletProxy("map", data = dataloc()) %>% 
     clearMarkers() %>% 
     addCircles(dataloc()$Y, 
        dataloc()$X, 
        color = "red") 
    } 
) 

滑块出现后print("event")不会发生。

我实际上有一个“submitButton”,它阻止了其他事件的发生。问题解决了!