Thanks.
But I think we when we make the tabs reactive, the url does not work. Example, click on 2 row on the DT table, it goes to the last tab with respective row (say 2) getting printed.
Now, when we copy that url and paste it in other tab, it does not show 2 there?
library(shiny)
library(DT)
ui <- function(req) {
navbarPage(
title = "TITLE",
position = "fixed-top",
inverse = TRUE,
id = "inTabset",
collapsible = TRUE,
# tabsetPanel(id = "tabs",
# tabPanel(
# "Read me",tags$head(tags$link(rel = "stylesheet", type="text/css", href="style.css"))
# ),
tabPanel("Summary",tags$head(tags$link(rel = "stylesheet", type="text/css", href="style.css")),DTOutput("tab")%>% withSpinner(color="#1560BD")
# ,tags$head(tags$script(src="myscript.js"))
),
tabPanel("tab3",br(),br(),br(),br(),
br(),
htmlOutput("iris"))
)
}
server <- function(input, output, session) {
observe({
# Trigger this observer every time an input changes
reactiveValuesToList(input)
session$doBookmark()
})
output$tab <- renderDataTable({
datatable(iris,selection = 'single')
})
observeEvent(input$tab_rows_selected,{
updateTabsetPanel(session,inputId = "inTabset",selected = "tab3")
output$iris <- renderUI({
as.character(input$tab_rows_selected)
})
})
onBookmarked(function(url) {
updateQueryString(url)
})
}
shinyApp(ui, server, enableBookmarking = "url")