ฉันกำลังสร้างแอปพลิเคชันที่เรามี 2 fluidPage()
อันดับแรก fluidPage()
มีตารางข้อมูลที่มีไฮเปอร์ลิงก์ในคอลัมน์เดียว ซึ่งจะเชื่อมโยงกับ fluidPage()
อื่นๆ
ในขณะที่มองหาสถานการณ์นี้ ฉันได้พบกับโซลูชัน ซึ่งเชื่อมโยงไปยัง tabPanel()
อื่น
ฉันพยายามสร้าง fluidPage()
สองตัวแบบนี้
library(shiny)
library(DT)
server <- function(input, output) {
output$iris_type <- DT::renderDataTable({
datatable(data.frame(Species=paste0("<a href='/th#filtered_data'",
"alt='",unique(iris$Species),"'",
"onclick=\"",
"$('#filtered_data').trigger('change').trigger('shown');",
"Shiny.onInputChange('species', getAttribute('alt'));",
"\">",
unique(iris$Species),
"</a>")),
escape = FALSE)
})
output$filtered_data <- DT::renderDataTable({
if(is.null(input$species)){
datatable(iris)
}else{
datatable(iris[iris$Species %in% input$species, ])
}
})
}
ui <- shinyUI(fluidPage(
mainPanel(
tabsetPanel(
tabPanel("Iris Type", DT::dataTableOutput("iris_type"))
))
),
fluidPage(
mainPanel(
DT::dataTableOutput("filtered_data")
)
)
)
shinyApp(ui = ui, server = server)
ฉันได้รับข้อความแสดงข้อผิดพลาด
Error in shinyUI(fluidPage(mainPanel(tabsetPanel(tabPanel("Iris Type", :
unused argument (fluidPage(mainPanel(DT::dataTableOutput("filtered_data"))))
ใครสามารถให้วิธีแก้ปัญหาที่เหมาะสมเมื่อคลิก species
เฉพาะตารางที่เกี่ยวข้องควรปรากฏในหน้าอื่นแทนที่จะแสดงในแท็บอื่น
ขอบคุณล่วงหน้า!!!
mainPanel
- person Pork Chop   schedule 17.08.2020