Appsilon / shiny.semantic

Shiny support for powerful Fomantic UI library.
http://appsilon.github.io/shiny.semantic
Other
497 stars 96 forks source link

[Bug]: Issues when rendering tabset #440

Open federiva opened 1 year ago

federiva commented 1 year ago

Guidelines

Project Version

0.4.3

Platform and OS Version

Ubuntu 22.04

Existing Issues

39

What happened?

Tabset is not being rendered as described in #63

library(shiny)
library(shiny.semantic)
library(rhandsontable)

# Sample data for the tables
data1 <- data.frame(Name = c("John", "Alice", "Bob"), Age = c(28, 24, 22))
data2 <- data.frame(Product = c("A", "B", "C"), Price = c(10, 20, 30))

# UI
ui <- semanticPage(
  title = "Example Issue 39",
  textOutput("text"),
  tabset(
    id = "tabset",
    tabs = list(
      # Content of Tab 1
      list(
        menu = "tab_1",
        content = tags$div(
          class = "ui segment",
          h1("Content of Tab 1"),
          rHandsontableOutput("tab1_table")
        ),
        id = "a_tab_1"
      ),
      # Content of Tab 2
      list(
        menu = "tab_2",
        content = tags$div(
          class = "ui segment",
          h1("Content of Tab 2"),
          rHandsontableOutput("tab2_table")
        ),
        id = "a_tab_2"
      )
    )
  )
)

# Server
server <- function(input, output, session) {
  # Content for Tab 1
  output$tab1_table <- renderRHandsontable({
    rhandsontable(data1)
  })
  # outputOptions(output, "tab1_table", suspendWhenHidden = FALSE)

  output$tab2_table <- renderRHandsontable({
    rhandsontable(data2)
  })
  # outputOptions(output, "tab2_table", suspendWhenHidden = FALSE)

  output$text <- renderText({
    paste(length(input$tab1_table), length(input$tab2_table))
  })
}

# Run the app
shinyApp(ui = ui, server = server)

Steps to reproduce

Scenario 1 not working

  1. Run the example app submitted in the description
  2. Check that the numbers above the tabset being rendered are 3 0

Scenario 2 - Working example using outputOptions

  1. In the app provided in the description uncomment the lines in which outputOptions is used
  2. Run the app
  3. Check that the numbers above the tabset are 3 3 (This indicates that the tables are being rendered appropriately) ...

Expected behavior

Tabset should render

Attachments

No response

Screenshots or Videos

No response

Additional Information

No response