forked from AntoineGuillot2/Shiny_SemiCollapsibleSidebar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
33 lines (31 loc) · 1.18 KB
/
server.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(shiny)
library(shinydashboard)
shinyServer(function(input,output,session){
vals<-reactiveValues()
vals$collapsed=FALSE
observeEvent(input$SideBar_col_react,
{
vals$collapsed=!vals$collapsed
}
)
output$Semi_collapsible_sidebar<-renderMenu({
if (vals$collapsed)
sidebarMenu(
menuItem(NULL, tabName = "dashboard", icon = icon("dashboard")),
menuItem(NULL, icon = icon("th"), tabName = "widgets",
badgeColor = "green"),
menuItem(NULL, icon = icon("bar-chart-o"),
menuSubItem(span(class="collapsed_text","Sub-item 1"), tabName = "subitem1"),
menuSubItem(span(class="collapsed_text","Sub-item 2"), tabName = "subitem2")
))
else
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Widgets", icon = icon("th"), tabName = "widgets", badgeLabel = "new",
badgeColor = "green"),
menuItem("Charts", icon = icon("bar-chart-o"),
menuSubItem("Sub-item 1", tabName = "subitem1"),
menuSubItem("Sub-item 2", tabName = "subitem2")
))
})
})