-
Notifications
You must be signed in to change notification settings - Fork 0
/
modDrop.R
40 lines (38 loc) · 1.38 KB
/
modDrop.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
34
35
36
37
38
39
40
uiDropdown <- function(id, label = "dropdown") {
ns <- NS(id)
semanticPage(
div(class = "ui horizontal segments",
div(class = "ui segment",
p("Select vessel type"),
dropdown_input(ns("shiptype"),
unique(shipsraw[,ship_type]),
#value = unique(shipsraw[,ship_type])[1],
default_text = "No vessel selected")
),
div(class = "ui segment",
p("Select ship name"),
uiOutput(ns("dropdown_sname"))
),
div(class = "ui segment",
p("Filter data"),
checkbox_input(ns("outliers"), "remove outliers",
is_marked = TRUE))
)
)
}
serverDropdown <- function(id) {
moduleServer(id,
function(input, output, session) {
ns <- NS(id)
dt <- reactive({
req(input$shiptype)
return(shipsraw[ship_type == input$shiptype,])
})
output$dropdown_sname <- renderUI(
dropdown_input(ns("shipname"), unique(dt()[,SHIPNAME]),
value = unique(dt()[,SHIPNAME])[1],
default_text = "No ship name selected"))
return(reactive({list(type = input$shiptype, name = input$shipname, outliers = input$outliers)}))
}
)
}