still learning how to use Shiny/R, sorry if the answer is obvious trying to cast on the map various layers based on selectize choices (multiple) So i got:
selectizeInput('bays', 'Select rough bay outlines',
choices = list("Residents" = "residents", `Pay to park` = "ptp",
"Shared use" = "shared"), multiple = TRUE)
Every equivalent is a geojson file that should be used for the map (here "residents", but of course it populates with a selected option from the selectize input):
topoData <- readLines("residents.geojson", warn = FALSE)
%>% paste(collapse = "\n")
leafletProxy("mymap") %>%
addPolylines(topodata)
how can i construct the observeEvent(input$bays,...) so every choice triggers the action above (with the right geojson file of course)? I can do it for a single choice but a multiple choice might call for another way. And would it be more effective to use a submit button or react to actions? Please note that it can be either adding or removing value from the selectize list? And finally there is a cool gadget in selectize - plugin "remove_button" - adding the entries with a little marker to remove the item - i have seen it for javascript but not for shiny - is it possible somehow?
$('#input-tags3').selectize({
plugins: ['remove_button'],
delimiter: ',',
persist: false,
create: function(input) {
return {
value: input,
text: input
}
}
});