[英]How to avoid collapsing with shinyWidgets dropdown and a datatable
I want to display a spreadsheet with some information in shinyWidgets
dropdown , sometimes spanning multiple pages. 我想在
shinyWidgets
下拉列表中显示包含一些信息的电子表格,有时会跨越多个页面。
If you click on the next page, the dropdown closes again. 如果单击下一页,则下拉列表将再次关闭。
How can I avoid this? 我怎么能避免这个?
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
br(),br(),br(),
p("How to go to the next page, without collapsing?"),
uiOutput("irisdrop", inline = TRUE)
)
server <- function(input, output, session) {
output$irisdrop <- renderUI({
dropdown(circle = FALSE, inputId = "iris",
label = "iris", status = "primary",
datatable(iris, rownames = NULL,
height = "100%",
selection = "none"
)
)
})
}
shinyApp(ui, server)
You can do something like this - 你可以这样做 -
library(shiny)
library(shinyWidgets)
library(DT)
ui <- fluidPage(
dropdownButton(
inputId = "iris",
label = "iris",
icon = icon("sliders"),
status = "primary",
circle = FALSE,
DT::dataTableOutput("iris_tb")
)
)
server <- function(input, output, session) {
output$iris_tb <- DT::renderDataTable({
datatable(iris, rownames = NULL,
height = "100%",
selection = "none"
)
})
}
shinyApp(ui, server)
Note: You can even use dropdown()
instead of dropdownButton()
from shinyWidgets
package. 注意:您甚至可以使用
dropdown()
而不是shinyWidgets
包中的dropdownButton()
。
dropdown()
is similar to dropdownButton()
but it don't use Bootstrap, so you can put pickerInput
in it. dropdown()
类似于dropdownButton()
但它不使用Bootstrap,因此您可以将pickerInput
放入其中。 Moreover you can add animations on the appearance / disappearance of the dropdown with animate.css
. 此外,您可以使用
animate.css
添加下拉列表的外观/消失动画。
For more detail, you can look at the page 30 of the following document - 有关更多详细信息,请查看以下文档的第30页 -
https://cran.r-project.org/web/packages/shinyWidgets/shinyWidgets.pdf https://cran.r-project.org/web/packages/shinyWidgets/shinyWidgets.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.