在下面来自https://glin.github.io/reactable/articles/examples.html#cross-widget-interactions的代码中,我希望能够通过单击地图图标来突出显示行条目,即与单击表格条目相反。
这可能吗(没有Shiny)?
library(crosstalk)
library(leaflet)
library(dplyr)
# A SpatialPointsDataFrame for the map.
# Set a group name to share data points with the table.
brew_sp <- SharedData$new(breweries91, group = "breweries")
# A regular data frame (without coordinates) for the table.
# Use the same group name as the map data.
brew_data <- as_tibble(breweries91) %>%
select(brewery, address, village, founded) %>%
SharedData$new(group = "breweries")
map <- leaflet(brew_sp) %>%
addTiles() %>%
addMarkers()
tbl <- reactable(
brew_data,
selection = "multiple",
onClick = "select",
rowStyle = list(cursor = "pointer"),
minRows = 10
)
htmltools::browsable(
htmltools::tagList(map, tbl)
)