-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditionalpanel inside Info_window html content #276
Comments
No idea I'm afraid. Can you share an example of what you're trying to do please? |
Sure, here is a reprex:
And this is sort of what I look for in the info_window:
|
where is |
oh sorry, use this: devtools::install_github("mhanf/ShinyRating") |
in theory you can specify an DOM inside the info window and it will work. Here's a minimal example, with the code taken from this SO answer Note that the library(shiny)
library(googleway)
# Define the UI
ui <- fluidPage(
google_mapOutput("map")
)
# Define the server
server <- function(input, output) {
# Create some dummy data
data <- data.frame(
lat = c(-27.469),
lon = c(153.0251),
siq = c(85),
info = paste0('<div id="content" style="width:400px; background-color:red;">',
'My Text comes here' ,
'</div>'
)
)
output$map <- renderGoogle_map({
google_map(key = secret::get_secret("GOOGLE")) %>%
googleway::add_markers(data = data, lat = "lat", lon = "lon", info_window = "info")
})
}
shinyApp(ui, server) |
Thanks Dave. Indeed, it works the way you frame it in your example but as soon as I include the conditonalpanel, it seems like the condition can't find the input I'm referring to and doesn't do anything. If I use your example and add the info html content as a column in the dataframe without the conditionalpanel it works
However, if I include the conditionalpanel then the rating component doesn't even show:
Should the input id 'test1' be referenced in a different way perhaps, for the condition in conditionalpanel to pick it up? |
After studying this more I think the issue is that when the info_window is triggered shiny doesn’t know anything about those inputs inside so they need to be binded for the conditional panel to pick it up. any ideas on how to bind those input elements in Shiny? |
Hey @dcooley , I've found a similar problem happening with Leaflet in stackoverflow and it was solved by binding the inputs via javascript. All credits to the authors (K. Rohde and Dean Attali) The following reprex uses leaflet's popup feature (info_window in google maps) with input elements in it. The key part is the javascript run on map rendering that binds all the inputs contained in the popups.
|
Hi there,
I’ve set up my markers with HTML content inside the info_window parameter. I’ve implemented some interactive features and one of the component is a switch input that changes the visibility of another component in there, however, it seems to ignore the condition and doesn’t do anything. Do you know if this is by design or is there another way to enable that interactivity inside the info_window?
Cheers
The text was updated successfully, but these errors were encountered: