From 78733686dd7271034fddf0c75fbfafadc48072fa Mon Sep 17 00:00:00 2001 From: Chuck Thompson Date: Sat, 7 Oct 2017 12:00:32 -0400 Subject: [PATCH] add in zoom functionality when sample is selected --- leaflet.R | 9 +++++++++ view_data.R | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/leaflet.R b/leaflet.R index 1fbdc8e..808f7a6 100644 --- a/leaflet.R +++ b/leaflet.R @@ -8,6 +8,15 @@ output$map <- renderLeaflet({ setView(lng = 14.815333, lat = 46.119944, zoom = 8) }) +observeEvent(input$uploadSampleData_row_last_clicked, { + x <- inputFileSamples() + selectedRow <- input$uploadSampleData_row_last_clicked + + leafletProxy('map') %>% + setView(lng = x[selectedRow, 'lng'], lat = x[selectedRow, 'lat'], zoom = 10) + +}, ignoreInit = TRUE) + # Add markers and lines for selected animals to map observe({ PS <- PS() diff --git a/view_data.R b/view_data.R index 84c0505..f9be68c 100644 --- a/view_data.R +++ b/view_data.R @@ -1,6 +1,6 @@ output$uploadSampleData <- renderDataTable({ x <- inputFileSamples() - DT::datatable(data = x, filter = "top", options = list(pageLength = 15)) + DT::datatable(data = x, filter = "top", options = list(pageLength = 15), selection = 'single') }) observe({