modal.size <- 'm'
text.width <- '100%'
textarea.width <- '570px'
textarea.height <- '200px'
date.width <- '100px'
numeric.width <- '100px'
select.width <- '100%'
defaultPageLength <- 10
title.delete <- 'Delete'
title.edit <- 'Edit'
title.add <- 'New'
label.delete <- 'Delete'
label.edit <- 'Edit'
label.add <- 'New'
label.copy <- 'Copy'
####================================================================================================####
#### DELETE ####
####================================================================================================####
# deleteModal <- function(selectedRow, result) {
#
# jscode <- paste0( '
# $("#deleteRows").on("click", function(){
# Shiny.onInputChange("buttonClicked",', selectedRow ,');
# })
# ')
#
# fields <- list()
# for(i in result$view.cols) {
# fields[[i]] <- div(paste0(i, ' = ', result$thedata[result$thedata[,"idbis"] == selectedRow,i]))
# }
# showModal(modalDialog(title = "Delete",
#
# shiny::p('Are you sure you want to delete this record?'),
# fields,
# footer = shiny::column(modalButton('Cancel'),
# shiny::actionButton("deleteRows", 'Delete'),
# width=12),
# tags$script(HTML(jscode)),
# size = 'm') #modal.size
# )
# }
deleteModal <- function(data, idbis, ns) {
# jscode <- paste0( '
# $("#deleteRows").on("click", function(){
# Shiny.onInputChange("buttonClicked",', idbis ,');
# })
# ')
#TODO fix this
jscode <- paste0( '
$("#', ns("deleteRows"), '").on("click", function(){
Shiny.onInputChange("', ns("buttonClicked"), '",', idbis ,');
})
')
col_list <-c('See', 'Action' , 'Domain', 'Titles', 'Footnotes', 'Filters', 'GDS Template', 'Program ID','outType','CRUD','idbis')
col_list2 <- intersect(names(data), col_list)
fields <- list()
for(i in col_list2) {
fields[[i]] <- div(paste0(i, ' = ', data[data[,"idbis"] == idbis,i]))
}
showModal(modalDialog(title = "Delete",
shiny::p('Are you sure you want to delete this record?'),
fields,
footer = shiny::column(modalButton('Cancel'),
shiny::actionButton(ns("deleteRows"), 'Delete'),
width=12),
tags$script(HTML(jscode)),
size = 'm') #modal.size
)
}
####================================================================================================####
#### eDIT ####
####================================================================================================####
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.