Below is a screenshot of my Shiny app, I have created a simple login
page to give access rights to the data only to the authenticated users. But I have the following issues,
- Unable to hide the
Mainpanel
on the start of the app, meaning- themainpanel
should behidden
on the start of the app and should bevisible
only afterLogin
button is pressed. After the
mainpanel
isvisible
thesidebar
where theUsername
,Password
andLogin button
should be hidden.
UI.R
library(shiny)
library(shinyjs)
shinyUI(fluidPage(
useShinyjs(),
titlePanel(
fluidRow(
column(9, h1("VHMS")),
column(1, img(src = '2.png', width = 100))), windowTitle = "my"),
br(),
br(),
br(),
br(),
sidebarLayout(
sidebarPanel(
textInput("Username", "Username"),
passwordInput("Password", "Password"),
actionButton("Login", "Login")),position = "right",
mainPanel(
fluidRow( column(12,
(tabsetPanel("views", type = "tabs",
tabPanel("TableView", dataTableOutput("df_directions")),
tabPanel("MapView", dataTableOutput("df_locations"))
)
)
)
)
)
)
)
)
Server.R
library(shiny)
library(shinyjs)
useShinyjs()
shinyServer(function(input, output) {
output$df_directions <- renderDataTable({
json_data1 }, options = list(scrollX = TRUE))
})
I'am able to address my issues individually but I am not able to integrate my Hide/Show
login into a single script.