Yang-Tang / shinyjqui

jQuery UI Interactions and Effects for Shiny

Home Page:https://yang-tang.github.io/shinyjqui/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jqui_sortable order overwritten by selectizeInput drag and drop

gacolitti opened this issue · comments

The order inside jqui_sortable() is lost when dragging and dropping choices for selectizeInput().

Here is a reproducible example:

library(shiny)
library(shinyjqui)

ui <- fluidPage(
      jqui_sortable(
        div(id = "lst",
        selectizeInput("c", "Select", c("a", "b"),
                       multiple = TRUE,
                       options = list(plugins = list('drag_drop')))
      )
  ),
  br(),
  br(),
  br(),
  verbatimTextOutput("lst_order")
)

server <- function(input, output, session) {
  
  output$lst_order <- renderPrint({
    str(input$lst_order$id)
  })
  
}

shinyApp(ui, server)

CleanShot 2021-12-28 at 15 09 47

What is causing this? Is there any way to avoid this behavior?

This is a bug. The drag_drop plugin of selectizeInput() is also based on jquery-ui. When you do the drag and drop inside the selectizeInput, it will trigger the same js event that causes jqui_sortable to react on it. It has been fixed now with 78a54b6