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

shiny add hidden columns in editable

parent 0a786546
......@@ -429,4 +429,26 @@ GENERATE_LANDSCAPE <- "Generates a landscape composed of fields where croptypes
RUN_SIMULATION <- "Run the simulation, depending of the parameters it can be long"
STOP_SIMULATION <- "Force to stop the simulation"
EXPORT_SIMULATION <- "Download a GPKG containing most of the parameters"
ROTATION_PERIOD <- "Croptypes rotation period in years. Will switch between 0 and 1 croptypes and 0 and 2 croptypes each period time. 0 mean no rotation"
\ No newline at end of file
ROTATION_PERIOD <- "Croptypes rotation period in years. Will switch between 0 and 1 croptypes and 0 and 2 croptypes each period time. 0 mean no rotation"
CULTIVARS_TOOLTIP <- c("Name of the cultivar",
"Host individuals density (in pure crop) per surface unit at the beginning of the cropping season",
"Maximum host individuals density (in pure crop) per surface unit at the end of the cropping season",
"Growth rate",
"Reproduction rate",
"Death rate",
"Theoretical yield in pure crop (in weight or volume unit / ha / cropping season) associated with the sanitary status ‘H’",
"Theoretical yield in pure crop (in weight or volume unit / ha / cropping season) associated with the sanitary status ‘L’",
"Theoretical yield in pure crop (in weight or volume unit / ha / cropping season) associated with the sanitary status ‘I’",
"Theoretical yield in pure crop (in weight or volume unit / ha / cropping season) associated with the sanitary status ‘R’",
"Planting costs in pure crop (in monetary units / ha / cropping season)",
"Market value of the product (in monetary units / weight or volume unit)")
GENES_TOOLTIP <- c("Name of the resistance gene",
"Efficiency of the resistance gene (percentage of reduction of the targeted aggressiveness component: IR, 1/LAT, IP or PR)",
"Expected delay to resistance activation (for APRs)",
"Variance of the delay to resistance activation (for APRs)",
"Probability for a pathogenicity gene to mutate",
"Number of adaptation levels related to each resistance gene (i.e. 1 + number of required mutations for a pathogenicity gene to fully adapt to the corresponding resistance gene)",
"maximal fitness penalty paid by a pathogen genotype fully adapted to the resistance gene on hosts that do not carry this gene",
"Strength of the trade-off relationship between the level of aggressiveness hosts that do and do not carry the resistance gene",
"Aggressiveness component targeted by the resistance gene")
\ No newline at end of file
......@@ -55,7 +55,8 @@ editableDTUI <- function(id) {
# Param row.default a default row (when adding a new line) depending of row.cols if not all cols existing
# Param row.colsid list of columns that apply row.default
# Param row.inc list of columns to incremente value at new line
editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), canRm = shiny::reactiveVal(TRUE), rownames = FALSE, tooltips = NULL, row.default = NULL, row.colsid = NULL, row.inc = NULL) {
# Param col.hidden index of columns to hide.
editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), canRm = shiny::reactiveVal(TRUE), rownames = FALSE, tooltips = NULL, row.default = NULL, row.colsid = NULL, row.inc = NULL, col.hidden = c()) {
moduleServer(
id,
function(input, output, session) {
......@@ -100,6 +101,7 @@ editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), c
dom = if (canRm()) { 'tB'} else "t",
scrollX = TRUE,
fixedColumns = TRUE,
columnDefs = list(list(visible=FALSE, targets=col.hidden)),
buttons = list(list( extend = "collection", text="Add line", icon = shiny::icon("plus"),
action = DT::JS(paste0("function ( e, dt, node, config ) {
Shiny.setInputValue('",id,"-addLine","', true,{priority: 'event'});
......
......@@ -132,7 +132,7 @@ server <- function(input, output, session) {
## Print Rotation labels
setRotationText <- function(list_name=NULL) {
text <- paste0("<u>1st rotation</u> : 0 (<b>",list_name[1],"</b>) and 1 (<b>",list_name[2],"</b>) croptypes")
text <- paste0(text, "<br/><u>2st rotation</u> : 0 (<b>",list_name[1],"</b>) and 2 (<b>",list_name[3],"</b>) croptypes")
text <- paste0(text, "<br/><u>2nd rotation</u> : 0 (<b>",list_name[1],"</b>) and 2 (<b>",list_name[3],"</b>) croptypes")
text
}
......@@ -912,9 +912,10 @@ server <- function(input, output, session) {
}),
canRm = advanced_mode,
rownames = FALSE,
tooltips = c("Cultivars Names"),
tooltips = CULTIVARS_TOOLTIP,
row.default = simul_params@Cultivars[1,],
row.inc = c(1)
row.inc = c(1),
col.hidden = which( names(simul_params_cultivars()) %in% c("reproduction_rate","death_rate")) -1
)
##### cultivars table modification #####
......@@ -925,11 +926,11 @@ server <- function(input, output, session) {
if (sum(is.na(cultivarsTable$value))) {
return(1)
}
# message("data ", cultivarsTable$data)
# message("value ", cultivarsTable$value)
# message("i ", cultivarsTable$row)
# message("j", cultivarsTable$col)
#message("data ", cultivarsTable$data)
#message("value ", cultivarsTable$value)
#message("i ", cultivarsTable$row)
#message("j", cultivarsTable$col)
if (isTRUE(advanced_mode())) {
if (#nrow(cultivarsTable$data) == 0 ||
......@@ -1029,7 +1030,7 @@ server <- function(input, output, session) {
}),
canRm = advanced_mode,
rownames = FALSE,
tooltips = c("Genes Names"),
tooltips = GENES_TOOLTIP,
row.default = simul_params@Genes[1,],
row.inc = c(1)
)
......
......@@ -91,11 +91,12 @@ landscapeTab <- {
width = 4,
IntegerInput(
inputId = "seed",
label = "Seed (for random number generator)",
label = "Seed (RNG)",
value = 12345,
max = 99999
)
)
),
shinyBS::bsTooltip("seed",title="Random Number Generator Seed", placement = "bottom", trigger="hover"),
)
)
}
......
Markdown is supported
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