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

fix shiny data types return by tables

parent bcc29bcb
......@@ -157,8 +157,8 @@ editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), c
nbcol <- nbcol+1
namecol <- c(colnames(rv$data),"delete")
}
newline <- matrix(rep(c("999"), nbcol), byrow = TRUE, ncol = nbcol)
colnames(newline) <- namecol
newline[nbcol] <- as.character(
shiny::actionButton(
paste("button", nrow(rv$data)+1, sep = "_"),
......@@ -167,9 +167,13 @@ editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), c
onclick = paste0('Shiny.setInputValue(\"', ns("deletePressed"), '\", this.id, {priority: \"event\"})')
)
)
newline <- as.data.frame(newline)
colnames(newline) <- namecol
sapply(1:nbcol, function(i){print( mode(rv$data[,i]));class(newline[,i]) <<- class(rv$data[,i]); mode(newline[,i]) <<- mode(rv$data[,i]); })
#print(sapply(newline,mode))
#DT::addRow(proxy,newline) # addRow bug, du coup on met a jour tout le tableau "server=FALSE"
shiny::isolate(rv$data <- rbind(rv$data, newline))
#print(rv$data)
#print(sapply(rv$data,mode))
# if (canRm() == TRUE) {
# proxy %>%
# DT::replaceData(data = cbind(rv$data, deleteButton(rv$data, "button", ns("deletePressed"))), resetPaging = FALSE, rownames = FALSE)
......
......@@ -830,17 +830,18 @@ server <- function(input, output, session) {
croptypes_proportions(croptypesTable$data[, "Proportions"])
can_gen_landscape$proportions <<- ProportionValidation()
if (can_gen_landscape$proportions == FALSE) can_run_simul$landscape <<- FALSE
if (isTRUE(advanced_mode())) {
shiny::isolate(simul_params_croptypes(croptypesTable$data[, 1:(ncol(croptypesTable$data) - 2)]))
if (checkCroptypesTable(croptypesTable$data[, -which(colnames(croptypesTable$data) %in% c("Proportions", "delete"))]) == FALSE) {
if (nrow(croptypesTable$data) == 0
|| checkCroptypesTable(croptypesTable$data[, -which(colnames(croptypesTable$data) %in% c("Proportions", "delete"))]) == FALSE) {
can_run_simul$croptypes <<- FALSE
can_gen_landscape$croptypeID <<- FALSE
}
else {
#print(croptypesTable$data)
#summary(croptypesTable$data)
simul_params <<- setCroptypes(simul_params, croptypesTable$data[, 1:(ncol(croptypesTable$data) - 2)])
can_run_simul$croptypes <<- TRUE
can_gen_landscape$croptypeID <<- TRUE
......
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