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

shiny tables behaviour check (nrow == 0) colnames

parent 9947f06b
......@@ -158,7 +158,7 @@ editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), c
namecol <- c(colnames(rv$data),"delete")
}
newline <- matrix(rep(c("999"), nbcol), byrow = TRUE, ncol = nbcol)
newline <- matrix(rep(c("0"), nbcol), byrow = TRUE, ncol = nbcol)
newline[nbcol] <- as.character(
shiny::actionButton(
paste("button", nrow(rv$data)+1, sep = "_"),
......@@ -169,7 +169,7 @@ editableDTServer <- function(id, DTdata, disableCol = shiny::reactiveVal(c()), c
)
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]); })
sapply(1:nbcol, function(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))
......
......@@ -883,7 +883,8 @@ server <- function(input, output, session) {
# message("j", cultivarsTable$col)
if (isTRUE(advanced_mode())) {
if (checkCultivarsTable(cultivarsTable$data[, -which(colnames(cultivarsTable$data) %in% c("delete"))]) == FALSE) {
if (#nrow(cultivarsTable$data) == 0 ||
checkCultivarsTable(cultivarsTable$data[, -which(colnames(cultivarsTable$data) %in% c("delete"))]) == FALSE) {
can_run_simul$cultivars <<- FALSE
}
else {
......@@ -900,15 +901,15 @@ server <- function(input, output, session) {
shiny::isolate(simul_params_croptypes(cbind(simul_params_croptypes(), rep(0, nrow(simul_params_croptypes())))))
simul_params@CultivarsGenes <<- rbind(simul_params@CultivarsGenes, rep(0, ncol(simul_params@CultivarsGenes)))
}
# rename a cultivars in croptypes
crop <- simul_params_croptypes()
colnames(crop) <- c(colnames(simul_params_croptypes())[1:2], cultivarsTable$data[, 1])
simul_params <<- setCroptypes(simul_params,crop)
if(nrow(cultivarsTable$data) != 0) simul_params <<- setCroptypes(simul_params,crop)
simul_params_croptypes(crop)
colnames(simul_params@CultivarsGenes) <<- genesTable$data[, 1]
if (nrow(simul_params@CultivarsGenes) != 0) rownames(simul_params@CultivarsGenes) <<- c(cultivarsTable$data[, "cultivarName"])
# if (nrow(simul_params@CultivarsGenes) != 0)
rownames(simul_params@CultivarsGenes) <<- c(cultivarsTable$data[, "cultivarName"])
simul_params_cultivarsgenes(simul_params@CultivarsGenes)
# update cultivars
......@@ -995,7 +996,8 @@ server <- function(input, output, session) {
# message("j", genesTable$col)
if (isTRUE(advanced_mode())) {
if (checkGenesTable(genesTable$data[, -which(colnames(genesTable$data) %in% c("delete"))]) == FALSE) {
if (#nrow(genesTable$data) == 0 ||
checkGenesTable(genesTable$data[, -which(colnames(genesTable$data) %in% c("delete"))]) == FALSE) {
can_run_simul$genes <<- FALSE
}
else {
......
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