I'm developing my first shiny app and I want to put some buttons on the mainPage that redirect to the menu subItens I've created.
I tried to do this using the menu subItens link, but it didn't work. So, I copied the code I used to do the menu subItens and put it in the actionButton code. It works well, but just on the first click. I need to reload the page to the button work again.
Do you guys have any idea how to fix it?
Here is the menuSubItem code
sidebarMenu( id = "tabs",
menuItem("Conjuntura", tabName = "conjuntura", icon = icon("chart-bar"),
menuSubItem("Visão Geral",
tabName = "visao_geral"),
menuSubItem("Atividade Econômica",
tabName = "atividade_economica"),
dashboardBody(
tabItems(
# tab visão geral
tabItem(
tabName = "visao_geral",
mod_conj_titulo_ui("titulo_ui_1")
),
# tab conjuntura
tabItem(
tabName = "atividade_economica",
mod_conj_atividade_economica_ui("atividade_economica_ui_1"),
mod_conj_atividade_economica_es_ui("atividade_economica_es_ui_1")
)
Here is the button code
actionButton(inputId = "atividade_economica",
label = menuSubItem(HTML("<br>Atividade<br>Econômica"),
tabName = "atividade_economica",
icon = icon("chart-line", class = "icon")),
class = "button"
)
I didn't put anything in the server to run the button. I think that that's the problem.