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

shiny bugfix add default line to editableTable use a save value now

parent b2f5c1b2
......@@ -52,9 +52,12 @@ croptypes_proportions <- shiny::reactiveVal(c(1))
## simul params reactive for view
## use to update view
simul_params_croptypes <- shiny::reactiveVal()
default_croptype <- c()
simul_params_cultivars <- shiny::reactiveVal()
default_croptype <- c()
simul_params_cultivarsgenes <- shiny::reactiveVal()
simul_params_genes <- shiny::reactiveVal()
default_gene <- c()
##################################################################
# Functions
......@@ -93,12 +96,12 @@ showErrorMessage <- function(id="errorMessage", selectorafter = "#", message = "
checkCroptypesTable <- function(data) {
isok <- TRUE
## croptype ID
shiny::removeUI(selector = "#croptypeIdError")
if( sum(is.na(as.numeric(data[,"croptypeID"]))) != 0 || length(unique(data[,"croptypeID"])) != length(data[,"croptypeID"]) ) {
showErrorMessage(id = "croptypeIdError", selectorafter= "#generateLandscape",
message = "Each croptype index must be a unique numeric")
isok <- FALSE
}
# shiny::removeUI(selector = "#croptypeIdError")
# if( sum(is.na(as.numeric(data[,"croptypeID"]))) != 0 || length(unique(data[,"croptypeID"])) != length(data[,"croptypeID"]) ) {
# showErrorMessage(id = "croptypeIdError", selectorafter= "#generateLandscape",
# message = "Each croptype index must be a unique numeric")
# isok <- FALSE
# }
## croptype name
shiny::removeUI(selector = "#croptypeNameError")
......
......@@ -797,6 +797,10 @@ server <- function(input, output, session) {
}
)
default_gene <<- simul_params@Genes[1,]
default_cultivar <<- simul_params@Cultivars[1,]
default_croptype <<- simul_params@Croptypes[1,c(1,2)]
simul_params_croptypes(simul_params@Croptypes)
simul_params_cultivars(simul_params@Cultivars)
simul_params_cultivarsgenes(simul_params@CultivarsGenes)
......@@ -868,7 +872,7 @@ server <- function(input, output, session) {
canRm = advanced_mode,
rownames = FALSE,
tooltips = c("Croptype index (starts at 0)","Croptype name"),
row.default = simul_params@Croptypes[1,c(1,2)],
row.default = default_croptype,
row.cols = 1:2,
row.inc = c(1,2)
)
......@@ -902,6 +906,7 @@ server <- function(input, output, session) {
}
else {
croptypesTable$data[,"croptypeID"] <- seq(1:nrow(croptypesTable$data))-1
print(croptypesTable$data)
output$rotationText <- renderUI({HTML(setRotationText(croptypesTable$data[, 2]))})
simul_params <<- setCroptypes(simul_params, croptypesTable$data[, 1:(ncol(croptypesTable$data) - 2)])
can_run_simul$croptypes <<- TRUE
......@@ -928,7 +933,7 @@ server <- function(input, output, session) {
canRm = advanced_mode,
rownames = FALSE,
tooltips = CULTIVARS_TOOLTIP,
row.default = simul_params@Cultivars[1,],
row.default = default_cultivar,
row.inc = c(1),
col.hidden = which( names(simul_params_cultivars()) %in% c("reproduction_rate","death_rate")) -1
)
......@@ -1047,7 +1052,7 @@ server <- function(input, output, session) {
canRm = advanced_mode,
rownames = FALSE,
tooltips = GENES_TOOLTIP,
row.default = simul_params@Genes[1,],
row.default = default_gene,
row.inc = c(1)
)
......
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