Skip to content

Commit

Permalink
make sure correlated2 can't be selected if only one num keyvar is sel…
Browse files Browse the repository at this point in the history
…ected
  • Loading branch information
bernhard-da committed Dec 18, 2018
1 parent eff645f commit 1d7fecb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions inst/shiny/sdcApp/controllers/ui_continuous.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ output$ui_noise <- renderUI({
# resetting to default values!
# also we have different parameters for methods (noise, p, delta) that we
# catch with a single slider
if (!has_numkeyvars()) {
has_nv <- has_numkeyvars()
if (!is.null(has_nv) && has_nv==FALSE) {
return(fluidRow(
column(12, h4("The current sdcProblem contains no",code("numerical key variables")), align="center"),
column(12, p("However,",code("addNoise()"),"can only be applied on such variables!
Expand Down Expand Up @@ -349,10 +350,21 @@ output$ui_noise <- renderUI({
width="75%", multiple=TRUE)
})

observe({
if (length(input$sel_noise_v)==1) {
updateSelectInput(session, inputId="sel_noise_method", choices = setdiff(choices_noise(), "correlated"))
} else {
updateSelectInput(session, inputId="sel_noise_method", choices = choices_noise())
}
})

# ui for 'btn_noise
output$ui_noise_btn <- renderUI({
btn <- NULL
if (has_numkeyvars() | length(input$sel_noise_v)>0) {
has_nv <- has_numkeyvars()
if (is.null(has_nv)) {
return(NULL)
}
if (has_numkeyvars() || length(input$sel_noise_v)>0) {
btn <- myActionButton("btn_noise", label="Add noise", "primary")
}
btn
Expand Down

0 comments on commit 1d7fecb

Please sign in to comment.