-
Notifications
You must be signed in to change notification settings - Fork 5
/
server.R
42 lines (36 loc) · 1.04 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
34
35
36
37
38
39
40
41
42
library(shiny)
library(DT)
library(queryBuildR)
shinyServer(function(input, output, session) {
sessionvalues <- reactiveValues()
sessionvalues$data<-loadData("")
observe({
if (length(input$queryBuilderSQL)>0)
sessionvalues$data<-loadData(input$queryBuilderSQL)
})
output$sqlQuery<-renderText({
sql<-""
if (length(input$queryBuilderSQL)>0) {
if (input$queryBuilderSQL!="")
sql<-paste0("where ",input$queryBuilderSQL)
}
paste0("select * from datatable ",sql)
})
output$queryBuilderWidget<-renderQueryBuildR({
data<-sessionvalues$data
load("filters.Rdata")
rules<-NULL
queryBuildR(rules,filters)
})
output$table<-renderDataTable({
data<-sessionvalues$data
colnames(data)<-as.vector(sapply(colnames(data),idToName))
action <- dataTableAjax(session, data,rownames=F)
datatable(data, rownames=F,
options = list(
dom= 'itp',
ajax = list(url = action)
)
)
}, server = TRUE)
})