I've reported this as a bug, but was wondering if anyone in the community encountered and successfully solved this issue.
Namely, if you want to remove an edge and then change your mind & click Cancel, all options for manipulation disappear.
To reproduce:
Run the app below
Click on Edit
Click on the edge
Click on Delete selected
Click on Cancel
require(shiny)
require(visNetwork)
library(dplyr)
init.nodes.df = data.frame(id = c("foo", "bar"),
label = c("Foo", "Bar"),
stringsAsFactors = F)
init.edges.df = data.frame(id = "foobar",
from = "foo",
to = "bar",
stringsAsFactors = F)
ui <- fluidPage(
fluidRow(
column(
width = 6,
visNetworkOutput("editable_network", height = "400px")
)
)
)
server <- function(input, output) {
graph_data = reactiveValues(
nodes = init.nodes.df,
edges = init.edges.df
)
output$editable_network <- renderVisNetwork({
visNetwork(graph_data$nodes, graph_data$edges) %>%
visOptions(manipulation = T)
})
}
shinyApp(ui, server)
This has nothing to do with shiny
itself. You can also simply run the code below in RStudio and follow the steps above in the Viewer:
library(dplyr)
library(visNetwork)
init.nodes.df = data.frame(id = c("foo", "bar"),
label = c("Foo", "Bar"),
stringsAsFactors = F)
init.edges.df = data.frame(id = "foobar",
from = "foo",
to = "bar",
stringsAsFactors = F)
visNetwork(init.nodes.df, init.edges.df) %>%
visOptions(manipulation = T)
However, note that I've added the shiny tag for the sole reason that people who use visnetwork on a daily basis may not really be following that tag. Happy to remove it if it doesn't fit the policy.
The issue was that one of the functions (clearPopUp
) hasn't been called. It has been fixed in 2.0.8
version accessible on CRAN.