r - sliderInput() 或 sliderTextInput() 是否有任何方法具有 NA 或 NULL 默认值?
问题描述
有没有办法让看起来像滑块的闪亮输入具有初始 NULL 或 NA 值?两者都sliderInput
不允许sliderTextInput
它们的默认值为空。
我很清楚selectInput
允许这样做(默认为character(0)
),但它的视觉风格对我一直在处理的应用程序无效。
输入后需要读取它们的值actionButton
,其中将进行一些检查以确保用户调整了所有输入。
我有一些 javascript 的基础知识,但需要一些关于如何创建解决方法的指导。
示例最小应用程序:
library(shiny)
library(shinyWidgets)
UI <- fluidPage(
sliderInput(
"test_1",
"Testing sliderInput",
min = 1,
max = 5,
value = 3 # don't allow leaving empty, NA or NULL
),
sliderTextInput(
"test2",
"Testing sliderTextInput",
choices = c("1 - Least",
"2 - Less",
"3 - Middle",
"4 - More",
"5 - Most"),
selected = NULL # allows NULL, but takes the first of 'choices' either way
)
)
server <- function(input, output, session) {
}
shinyApp(UI, server)
解决方案
推荐阅读
- logging - 配置 datadog 代理以避免 kube-proxy 日志
- javascript - React 内部的状态管理如何?
- python - 如何使用 python 检测重叠的 SVG 路径?
- java - 获取 java.lang.ClassCastException: [B cannot be cast to org.springframework.messaging.Message 消费批次后异常
- c# - WPF 访问 Mainwindow 类之外的变量
- javascript - 在一个angular8应用中,如何知道整个项目配置了多少条路由?
- android - 按特定属性对 Class 列表进行排序
- node.js - 如何从使用异步函数的方法返回数据?
- php - 使用 PHP 执行 curl 请求
- azure-data-factory - ADF 如果发生什么情况
的 是否太大?