-
Notifications
You must be signed in to change notification settings - Fork 5
/
server.R
28 lines (23 loc) · 887 Bytes
/
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
library(shiny)
values = reactiveValues()
values$dat = data.frame(id = 1:10, name = LETTERS[1:10], grade = round(rnorm(10, 3, 0.5), 2))
shinyServer(function(input, output, session) {
# An observer is used to send messages to the client.
# The message is converted to JSON
observe({
if(input$deleteConfirmDlgBtn > 0){
isolate(values$dat <<- values$dat[values$dat$id != input$idSelector,])
}
})
observe({
if(input$deleteBtn > 0){
isolate(
session$sendCustomMessage(type = 'dialogContentUpdate',
message = list(id = "deleteConfirmDlg",
message = paste0('Are you sure to delete the record with id number ',
input$idSelector)))
)
}
})
output$myTable <- renderDataTable(values$dat)
})