Commit f77a1c94 authored by Jean-Francois Rey's avatar Jean-Francois Rey
Browse files

shiny module editableDT add tooltips for headers

parent fa83aa12
......@@ -51,7 +51,8 @@ editableDTUI <- function(id) {
# Param disableCol reactiveVal for colnames not editable
# Param canRM reactiveVal TRUE add delete button otherwise not
# Param rownames TRUE if show rownames FALSE otherwise
editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), canRm = shiny::reactiveVal(TRUE), rownames = FALSE) {
# Param tooltips header tooltips message
editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), canRm = shiny::reactiveVal(TRUE), rownames = FALSE, tooltips = NULL) {
moduleServer(
id,
function(input, output, session) {
......@@ -100,7 +101,15 @@ editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), c
action = DT::JS(paste0("function ( e, dt, node, config ) {
Shiny.setInputValue('",id,"-addLine","', true,{priority: 'event'});
}"))))
)
),
callback = if( !is.null(tooltips)) {
JS(paste0("var tips = ['",paste0(tooltips,sep='',collapse='\',\''),"'],
header = table.columns().header();
for (var i = 0; i < tips.length; i++) {
$(header[i]).attr('title', tips[i]);
}"))
}
else {JS("")}
)
......
......@@ -811,7 +811,8 @@ server <- function(input, output, session) {
}
}),
canRm = advanced_mode,
rownames = FALSE
rownames = FALSE,
tooltips = c("Croptypes ID (start at 0)","Croptypes Name")
)
##### croptypes table modification #####
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment