我目前正在尝试将 Shiny 中的数据表中的选择限制为仅两行 - 我希望该表不允许用户单击多于行(但也能够在之后取消选择它们)。
library(DT)
shinyApp(
ui = fluidPage(
fluidRow(
column(12,
dataTableOutput('table')
)
)
),
server = function(input, output) {
output$table <- DT::renderDataTable(iris,
options = list(selection = "multiple")
)
}
)
Run Code Online (Sandbox Code Playgroud)
行选择当前处于多重模式,该模式有效,但我不希望选择超过两行。
我目前正试图找到一种方法来隐藏/显示R Shiny中的整个box()元素(以及里面的所有内容).我想创建一个可能是一个按钮,允许用户扩展一个特定的框,然后用相同(甚至不同)的按钮隐藏它.我不想使用conditionalPanel,因为我的应用程序非常大并且会产生一些问题.
示例代码可以在下面找到:
library(shiny)
library(shinydashboard)
library(collapsibleTree)
require(colorspace)
# Dataset is from https://community.tableau.com/docs/DOC-1236
load(system.file("extdata/Superstore_Sales.rda", package = "collapsibleTree"))
# For the sake of speed, let's only plot sales in Ontario
Superstore_Sales <- Superstore_Sales[Superstore_Sales$Region=="Ontario",]
# Define UI for application that draws a collapsible tree
ui <- fluidPage(
# Application title
titlePanel("Collapsible Tree Example 3: Gradient Mapping"),
# Sidebar with a select input for the root node
sidebarLayout(
sidebarPanel(
tags$a(href = "https://community.tableau.com/docs/DOC-1236", "Sample dataset from Tableau")
),
# Show a tree diagram with the …Run Code Online (Sandbox Code Playgroud)