-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
60 lines (54 loc) · 1.94 KB
/
app.R
File metadata and controls
60 lines (54 loc) · 1.94 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
##################################
# Created by EPI-interactive
# 30 Apr 2019
# https://www.epi-interactive.com
##################################
library(shiny)
library(DT)
library(dplyr)
shinyApp(
ui = fluidPage(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "css/style.css")
),
fluidRow(class="header-row",
h1("Datatable overlay"),
tags$img(src="images/Epi_Logo.png", width= "200px", height = "30px")
),
div(class="main",
dataTableOutput("tableUI")
)
),
server = function(input, output, session) {
names(iris) <- c("Speal length", "Sepal width", "Petal length", "Petal width", "Species")
output$tableUI = renderDataTable({
dat <- iris %>% mutate(More = paste0('<span><a href="javascript:void(0)" onmousedown="',
'Shiny.onInputChange(\'DTClick\',[', 1:n(), ',Math.random()]);',
'event.preventDefault(); event.stopPropagation(); return false;"><font color="grey"><b>...</b></font></a></span>'))
datatable(dat,
rownames = FALSE,
selection ="none",
escape = FALSE)
})
output$modalContent <- renderDataTable({
dat <- iris[as.numeric(input$DTClick[1]),]
datatable(dat,
rownames = FALSE,
selection ="none",
options = list("lengthChange" = FALSE,
"searching" = FALSE,
"paging" = FALSE,
"info" = FALSE,
"ordering" = FALSE))
})
observeEvent(input$DTClick, {
showModal(modalDialog(
title = paste0("Row ", as.numeric(input$DTClick[1])),
dataTableOutput("modalContent"),
size = "l",
easyClose = TRUE,
footer = NULL
))
})
}
)