2017-02-10 112 views
0

我有一個閃亮的應用程序是:滑塊在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")不會發生。

回答

0

我實際上有一個「submitButton」,它阻止了其他事件的發生。問題解決了!