Skip to content
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

showModal does not pop up with renderSankeyNetwork in Shiny App. #216

Closed
Sourabh1221 opened this issue Sep 16, 2017 · 5 comments
Closed

Comments

@Sourabh1221
Copy link

Sourabh1221 commented Sep 16, 2017

Hi,

I am developing a Shiny application which has two components Sankey Diagram and one action button which pop up "SaveMsg" dialog box on click of button .

I am seeing unexpected behavior where, If I user actionbutton and Sankeyvisualization in one dashboard, on click of action button, dashboard screen greyed out.

however If I comment Sankey code and keep only Action button on UI, Action button works as expected by showing pop up message of "save successfull".
If I comment action button code and keep only Sankey code in UI, I am able to see sankey output on dashboard.

Sankey code and action button both are working as expected separately, however if I place both in one dashboard action button greyed outscreen dashboard screen.

I have also attached recreated sample code-

library(shiny)
library(networkD3)
library(shinydashboard)

value <-  c(12,21,41,12,81)
source <- c(4,1,5,2,1)
target <- c(0,0,1,3,3)
edges2 <- data.frame(cbind(value,source,target))

names(edges2) <- c("value","source","target")
indx  <- c(0,1,2,3,4,5)
ID    <- c('CITY_1','CITY_2','CITY_3','CITY_4','CITY_5','CITY_6')
nodes <-data.frame(cbind(ID,indx))

ui <- dashboardPage(
  dashboardHeader(
  ),
  dashboardSidebar(disable = TRUE),
  dashboardBody(
    fluidPage(
      actionLink("savebtn", "Save button")
      ,sankeyNetworkOutput("simple")
    )
  )
)

server <- function(input, output,session) {

  observeEvent(input$savebtn, {
    showModal(modalDialog(
      title = "Save successful"))
  })

  output$simple <- renderSankeyNetwork({
    sankeyNetwork(Links = edges2, Nodes = nodes,
                  Source = "source", Target = "target",
                  Value = "value",  NodeID = "ID" 
                  ,units = "SSN" )
  })
}

shinyApp(ui = ui, server = server)
@cjyetman
Copy link
Collaborator

This is very likely the same problem as described in #214 and resolved in #215

@Sourabh1221
Copy link
Author

Hi cjyetman ,
Thanks for prompt response, Can you please confirm what action steps I have to take either in installing new package or to updating anything in Shiny D3NETWORK code.
Thanks!!

@cjyetman
Copy link
Collaborator

At the moment, you would have to clone the repo and apply PR #215, then install the modified package. Otherwise, wait until PR #215 has been merged, and then you will be able to install the dev version with...

devtools::install_github("christophergandrud/networkD3")

@cjyetman
Copy link
Collaborator

Looks like this is/will be finally fixed upstream with rstudio/shiny@3d11780

will close this issue once I have verified it

@cjyetman
Copy link
Collaborator

This issue has been resolved with the dev version of shiny and should be released on CRAN soon as shiny v1.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants