-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModularDataView.R
More file actions
48 lines (36 loc) · 1.54 KB
/
ModularDataView.R
File metadata and controls
48 lines (36 loc) · 1.54 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
require(DT)
# MODULE UI
DataViewUI <- function(id) {
ns <- NS(id)
DT::dataTableOutput(ns("table1"), width = "100%")
}
# MODULE Server
DataViewServer <- function(input, output, session, data, data_out_name) {
output$table1 <- renderDataTable({
DT::datatable( data()
, rownames = FALSE
, style = 'bootstrap'
, class = paste( c('compact', 'cell-border' , 'hover' , 'stripe') , collapse = " ")
, filter = 'top'
, extensions = c( 'Buttons' , 'KeyTable' , 'ColReorder' , 'FixedColumns' , 'FixedHeader')
, options = list(
dom = 'Bfrtip'
, autoWidth = TRUE
, columnDefs = list( list( width = '200px', targets = 1 ) )
, colReorder = TRUE
, paging = F
, keys = T
, scrollX = TRUE
, scrollY = TRUE
, fixedHeader = TRUE
, buttons = list(
'colvis'
, 'copy'
, 'print'
, list( extend = 'collection', buttons = list(list(extend='csv', filename = data_out_name)
, list(extend='excel', filename = data_out_name)
, list(extend='pdf', filename= data_out_name) )
, text = 'Download'
) ) ) )
})
}