dreamRs / dreamRs/gridstackr

Input elements don't work as expected when in a grid container

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
24
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Hi @pvictor!

When I put input element within a grid, they stop working. That said, I still see the class `shiny-bound-input`, so I don't see why it should not work:

```r
library(shiny)
library(bslib)
library(ggplot2)
library(gridstackr)
library(sortable)

ui <- page_fillable(
tags$h2("GridStack example"),
layout_sidebar(
sidebar = sidebar(
width = 300,
gridstackOutput("bucket")
),
gs_trash(id = "mytrash", label = "Drag here to remove", height = "50px"),
gridstackOutput("dashboard")
)
)

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

output$bucket <- renderGridstack({
gridstack(
disableResize = TRUE,
column = 1,
options = list(
acceptWidgets = TRUE,
dragOut = TRUE
),
gs_item(
selectInput("variable", "Variable:",
c("Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear")),
tableOutput("data")
))
})

output$dashboard <- renderGridstack({
gridstack(
margin = "10px",
cellHeight = "140px",
resize_handles = "all",
float = TRUE,
options = list(
acceptWidgets = TRUE
),
trash_id = "mytrash"
)
})

observeEvent(input$dashboard_layout, {
print(input$dashboard_layout)
})

output$data <- renderTable({
mtcars[, c("mpg", input$variable), drop = FALSE]
}, rownames = TRUE)

}

shinyApp(ui, server)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.