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.
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:
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.