我正在试验shinyjqui套餐:
一个特别有趣的函数是orderInput()
.使用connect
参数,我们可以拖放项目,如下所示:https://cran.r-project.org/web/packages/shinyjqui/vignettes/orderInput.html
我试图将项目拖放到网格表中,但不幸的是,它没有按预期工作.
以下是我到目前为止开发的代码:
library(shiny)
library(shinyjqui)
connections <- c('my_grid') # id of the grid table
ui <- fluidPage(
# some styling
tags$head(
tags$style(HTML("
.grid-table {
width: 150px;
border-collapse: collapse;
}
.grid-cell {
width: 100%;
height: 50px;
border: 1px solid black;
background-color: white;
text-align: center;
margin: 0;
padding: 0;
}
.grid-cell-text {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
background-color: steelblue;
color: white;
font-size: 18px;
}
.droppable-cell {
background-color: lightgray;
}
.table-container {
display: flex;
position: absolute;
left: 550px;
top: 30px;
margin-top: 0px;
overflow: hidden;
}
"))
),
div(class = "table-container",
div(class = "grid-table", id = "my_grid",
div(class = "grid-row",
div(class = "grid-cell grid-cell-text", "my_grid"),
div(id = "droppable_cell_1", class = "grid-cell droppable-cell", ""),
div(id = "droppable_cell_2", class = "grid-cell droppable-cell", ""),
div(id = "droppable_cell_3", class = "grid-cell droppable-cell", ""),
div(id = "droppable_cell_4", class = "grid-cell droppable-cell", ""),
div(id = "droppable_cell_5", class = "grid-cell droppable-cell", ""),
div(id = "droppable_cell_6", class = "grid-cell droppable-cell", ""),
div(id = "droppable_cell_7", class = "grid-cell droppable-cell", "")
)
),
orderInput('letters', 'Letters', items = LETTERS[1:7],
connect = connections) # defined above
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)