Yang-Tang / shinyjqui

jQuery UI Interactions and Effects for Shiny
https://yang-tang.github.io/shinyjqui/
Other
273 stars 32 forks source link

draggables not working in shiny modals #6

Closed shosaco closed 7 years ago

shosaco commented 7 years ago

Hi,

draggabled is unfortunately not working when used with shiny modals. To be specific, upon the second opening of the modal, the modal is not draggable anymore. It is only draggable upon the first opening. Using jqui_draggable works only from the second time on (these are 2 defects).

library(shiny)

ui <- fluidPage(
  actionButton("show", "show")
)

server <- function(input, output) {
  observeEvent(input$show, {
    showModal(jqui_draggabled(modalDialog(
      title = "Somewhat important message",
      "This is a somewhat important message.",
      easyClose = TRUE
    )))
  })
}
shinyApp(ui, server)
Yang-Tang commented 7 years ago

Thank you! @shosaco I just pushed an update (71a851ad0efaa0ca3a90ae6dcf1d5ddaf9e14dc4) to fix the jqui_draggabled problem. It should works now. For jqui_draggable, I found it also works on the first opening. Please see my code below and also the discuss in #4 :

library(shiny)
library(shinyjqui)

ui <- fluidPage(
  actionButton("show", "show")
)

server <- function(input, output) {
  observeEvent(input$show, {
    showModal(modalDialog(
      title = "Somewhat important message",
      "This is a somewhat important message.",
      easyClose = TRUE
    ))
    jqui_draggable(selector = '.modal-content')
  })
}

shinyApp(ui, server)
shosaco commented 7 years ago

Thank you! draggabled is working, and draggable only has a problem in Firefox, in Internet Explorer it's ok. I will go for draggabled then. Thanks!