Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

386
Views
Quiero crear un modalDialog arrastrable en brillante

Quiero crear un shiny::modalDialog() arrastrable con solo shiny y JS/jQuery y sin otros paquetes como shinyjqui . Siguiendo el ejemplo de aquí , debería ser fácilmente alcanzable con jQuerys .draggable , ya que el modalDialog creado al hacer clic en el botón de actionButton tiene una clase de arranque modal , pero de alguna manera no funciona. ¿Alguien tiene algún consejo?

 library(shiny) library(bslib) ui = fluidPage(theme = bs_theme(version = 5), div(style = "margin: 4rem; display: flex; justify-content: center;", div( actionButton(inputId = "action", label = "open modal"))), tagList( tags$script(HTML('$(".modal").draggable({ handle: ".modal-header" });'))) ) server = function(input, output, session){ observeEvent(input$action, { showModal( modalDialog( title = "Modal", easyClose = T)) }) } shinyApp(ui, server)
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Si no desea usar shinyjqui , aún necesita agregar jQuery UI para usar .draggable . Además de la biblioteca JS que falta, su código no funciona porque no puede habilitar la funcionalidad arrastrable a un elemento que aún no existe. Debe agregar el código JS justo después de la creación del modal dentro de showModal .

 library(shiny) library(bslib) ui = fluidPage(theme = bs_theme(version = 5), tags$head(tags$script(src="https://code.jquery.com/ui/1.13.0/jquery-ui.js")), div(style = "margin: 4rem; display: flex; justify-content: center;", div( actionButton(inputId = "action", label = "open modal")) ) ) server = function(input, output, session){ observeEvent(input$action, { showModal( tagList( modalDialog(title = "Modal", easyClose = T), tags$script(HTML('$(".modal").draggable({ handle: ".modal-header" });')) ) ) }) } shinyApp(ui, server)

Todavía es posible usar solo JS como se describe aquí .

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!