Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI on verticalTabPanel does not update #237

Closed
bobbeltje opened this issue Nov 7, 2019 · 2 comments
Closed

UI on verticalTabPanel does not update #237

bobbeltje opened this issue Nov 7, 2019 · 2 comments

Comments

@bobbeltje
Copy link

@bobbeltje bobbeltje commented Nov 7, 2019

The UI of a verticalTabPanel does not seem to trigger an update when it should. Curiously, it works for the first verticalTabPanel, but not for the second one. Here is an example:

library(shiny)
library(shinyWidgets)
library(DT)

ui <- navbarPage(
  title='nav',
  tabPanel(
    title='nav1',
    verticalTabsetPanel(
      verticalTabPanel(
        title='page_1',
        actionButton('load_table1', 'Load table'),
        dataTableOutput('tbl1')
      ),
      verticalTabPanel(
        title='page_2',
        actionButton('load_table2', 'Load table'),
        dataTableOutput('tbl2')
      )
    )
  ),
  tabPanel(title='tab2', 'empty')
)
server <- function(input, output){
  show_tbl1 <- reactiveVal(F)
  show_tbl2 <- reactiveVal(F)
  observeEvent(input$load_table1, ignoreInit=T, {
    show_tbl1(T)
  })
  observeEvent(input$load_table2, ignoreInit=T, {
    show_tbl2(T)
  })
  output$tbl1 <- renderDataTable({
    if (!show_tbl1()) return(NULL)
    datatable(data.frame(x=1:10))
  })
  output$tbl2 <- renderDataTable({
    if (!show_tbl2()) return(NULL)
    datatable(data.frame(x=1:10))
  })
}
shinyApp(ui, server)

Clicking the action buttons on page_1 and page_2 should render a table on the vertical tabs, but it only works on page_1. For the second one to be triggered you need to navigate to tab2 of the navbar and back to tab1.

I noticed this is an issue in shiny 1.4.0, but not in 1.3.2 or 1.2.0.

@pvictor
Copy link
Member

@pvictor pvictor commented Nov 7, 2019

Thanks, an error cause by jQuery update in last shiny version i think.
That's fixed.

Victor

@bobbeltje
Copy link
Author

@bobbeltje bobbeltje commented Nov 11, 2019

Awesome, thanks for the quick fix.

@bobbeltje bobbeltje closed this Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.