I drawn a map with a 'datatable' using some packages in R. To have more space in leaflet map, I need a button to show/hide the datatable part. How to do it? The R code is below:
library(leaflet)
library(DT)
library(crosstalk)
df <- read.csv(textConnection(
"Name,Lat,Long
Samurai Noodle,47.597131,-122.327298
Kukai Ramen,47.6154,-122.327157
Tsukushinbo,47.59987,-122.326726"
))
sdf <- SharedData$new(df, df$Name)
lflt<-leaflet(sdf) %>% addTiles() %>%
addMarkers(~ Long, ~ Lat)%>%addEasyButtonBar(
easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("+")),
onClick = JS("function(btn, map){ alert(\"Button 1\");}")))
bscols(lflt, datatable(sdf, width = "100%"))