ASP.NET MVC向导问题(ASP.NET MVC Wizard issue)
您好我已经使用这篇文章在asp.net mvc中创建了一个向导:asp.net mvc中的多步注册过程问题(splitted viewmodels,single model)
它仅适用于IStepViewModel接口背后的具体类的数据注释
在StepViewModelBinder中是否可以添加一些功能来执行具体步骤上的模型绑定器?
提前致谢
Hi i've used this post to create a wizard in asp.net mvc: multi-step registration process issues in asp.net mvc (splitted viewmodels, single model)
It works only with dataannotations on the concrete classes behind the interface IStepViewModel
Is it possible in the StepViewModelBinder to add some functionality to execute a modelbinder on the concrete steps?
Thanks in advance
原文:https://stackoverflow.com/questions/17297935
最满意答案
当选中/取消选中相应的复选框时,我通过显式显示/隐藏
numericInput
修复代码。 此外,我用observe
更改observeEvent
,以确保观察者在没有选中任何复选框时做出反应。library(shiny) library(shinyjs) library(magrittr) ui <- fluidPage( useShinyjs(), checkboxGroupInput(inputId = "company", label = "Select a company", choices = LETTERS[1:3]), uiOutput(outputId = "amounts") ) server <- function(input, output){ company_names <- LETTERS[1:3] num_ids <- paste0("amount", LETTERS[1:3]) output$amounts <- renderUI({ num_inputs <- lapply(1:3, function(i){ numericInput(inputId = num_ids[i], label = paste0("Investment in ", company_names[i]), value = 0, min = 0, max = 5000) }) %>% tagList shinyjs::hidden(num_inputs) }) observe({ for(i in company_names){ if (i %in% input$company) { shinyjs::show(id = paste0("amount", i)) } else { shinyjs::hide(id = paste0("amount", i)) } } }) } shinyApp(ui = ui, server = server)
I fixed your code by explicitly show/hide the
numericInput
when the corresponding check box is selected/unselected. Also I change theobserveEvent
withobserve
to make sure that the observer reacts when none of the check boxes are selected.library(shiny) library(shinyjs) library(magrittr) ui <- fluidPage( useShinyjs(), checkboxGroupInput(inputId = "company", label = "Select a company", choices = LETTERS[1:3]), uiOutput(outputId = "amounts") ) server <- function(input, output){ company_names <- LETTERS[1:3] num_ids <- paste0("amount", LETTERS[1:3]) output$amounts <- renderUI({ num_inputs <- lapply(1:3, function(i){ numericInput(inputId = num_ids[i], label = paste0("Investment in ", company_names[i]), value = 0, min = 0, max = 5000) }) %>% tagList shinyjs::hidden(num_inputs) }) observe({ for(i in company_names){ if (i %in% input$company) { shinyjs::show(id = paste0("amount", i)) } else { shinyjs::hide(id = paste0("amount", i)) } } }) } shinyApp(ui = ui, server = server)
相关问答
更多-
以下代码删除了我的错误,我抑制了警告 output$op1 = renderUI({ op1 = unique(df()$COL_OP1) op1 = op1[order(op1)] checkboxGroupInput('OP1', 'Choose OP1', op1, selected = op1) }) output$op2 <- renderUI({ if(is.null(input$OP1)) return(NULL) op2 ...
-
您可以使用: need(!is.null(input$marker1) | !is.null(input$marker2) | !is.null(input$marker3), 'Check at least one color!') You can use: need(!is.null(input$marker1) | !is.null(input$marker2) | !is.null(input$marker3), 'Check at least one color!')
-
要找出确切的问题并不容易,因为你有很多代码重复,你的格式很难解析。 如果您正在使用RStudio Ctrl + I和Ctrl + Shift + A将分别重新缩进行并重新格式化代码。 以下是我注意到的一些问题: 未使用input$color设置,因为检查input$lines值的其他逻辑只是用aes(color=color)覆盖它。 当您分解出大量重复代码时,这更容易看到。 checkboxGroupInput("lines","Lines",choices=c("lm","loess"))应该是radio ...
-
我认为你的dInput需要一个reactive ,并在你的过滤数据上再添加一个。 然后,您可以使用data_table() (使用() )进行进一步操作。 下面的(单个文件)代码在我的机器上正常工作。 我也删除了observe (无用)并更改了dInput返回的内容(实际文件而不是colnames)。 library(shiny) server <- shinyServer(function(input, output) { dInput <- reactive({ inFile < ...
-
我将使用以下代码更改您定义点反应变量的部分(代码使用dplyr包): points <- reactive({ validate( need(input$d_Governorate != "", 'Please choose at least one feature.') ) temp <- select(parks, lon, lat) if (input ...
-
在checkboxGroupInput选择NA实际上会返回空字符串"" 。 您可以使用is.na来修复过滤器: data <- test_data %>% filter( b %in% input$b_select | ( is.na(b) & "" %in% input$b_select ) ) Selecting NA in checkboxGroupInput actually returns empty string "". You can use with is.na to fix the ...
-
您可以使用updateCheckboxGroupInput ,如下所示: server = function(input, output,session){ players = eventReactive(input$submit,{input$addplayer}) observeEvent(input$submit,{ write.table(players(), paste0(file_path, "players.csv"), col.names = F ...
-
正如@warmoverflow建议的那样,使用observeEvent和updateCheckboxGroupInput 。 你应该从例子中得到它的要点。 码: library(shiny) l2_choices <- list("L2_1" = "Level 2-1", "L2_2" = "Level 2-2", "L2_3" = "Level 2-3") l3_choices <- list("L3_1" = "Level ...
-
当选中/取消选中相应的复选框时,我通过显式显示/隐藏numericInput修复代码。 此外,我用observe更改observeEvent ,以确保观察者在没有选中任何复选框时做出反应。 library(shiny) library(shinyjs) library(magrittr) ui <- fluidPage( useShinyjs(), checkboxGroupInput(inputId = "company", label = "Select a company", choices ...
-
使用上面的代码,您可以使用input$numSelector调用所选值的向量。 这些可以传递到数据框以进行过滤,或传递给任何其他Shiny输出对象。 打印值: print(input$numSelector) 过滤 data[data$dataName %in% input$numSelector,] 要使此打印代码运行,需要将其放在observe()函数中。 Using the code above, you can call a vector of the values selected using ...