【问题标题】:Shiny Datatable Click ID not working闪亮的数据表点击 ID 不起作用
【发布时间】:2018-04-15 18:23:35
【问题描述】:

又回来了。在一个项目上工作,我被困住了。我的点击不起作用。我已经尝试了每一次迭代,但无法弄清楚。基本上我想通过单击在数据表中选择多行,此时我将进行更多过滤。我遇到问题的点击。这是我的代码...你看到我遗漏的任何东西了吗?谢谢。 图书馆(预测) 图书馆(闪亮) 图书馆(闪亮的主题) 图书馆(ggplot2) 图书馆(dplyr) 图书馆(秤) 图书馆(DT)

库(预测) 图书馆(闪亮) 图书馆(闪亮的主题) 图书馆(ggplot2) 图书馆(dplyr) 图书馆(秤) 图书馆(DT)

source("NEW.R", local = TRUE)

branch1 <- unique(distinctlineitems$BRANCH)


 ui <- navbarPage(
 theme = shinytheme("cosmo"),
 title = "EXPENDITURES",
 tabPanel("TAB1",

       sidebarLayout(
         sidebarPanel(
           checkboxGroupInput("branches",label = NULL,choices = branch1      ,selected = NULL),
           actionButton('selectallB','Select All'),
           textInput("words", "Search"),
           h5("Separate keywords with commas."),
           plotOutput("plot", width = "100%"),
           plotOutput("season", width = "100%")),



         # Show a plot of the generated distribution
         mainPanel(
           fluidRow(csvDownloadUI("dwnld", "DOWNLOAD"), style =       "padding:10px"),
           DT::dataTableOutput("table")

 server <- function(input, output, session) {
 branchfilter <- reactive({
 filt <- distinctlineitems[distinctlineitems$BRANCH %in% input$branches,]
 return(filt)
 })

graphids <- reactive({
if(length(input$table_rows_selected) < 1) return(NULL)
id <- input$table_rows_selected
x <- branchfilter()$REMARKS[id]
})
output$table <- renderDataTable({
  test <- DT::datatable(branchfilter(),
               filter = "top",
               rownames = FALSE,
               selection = "multiple")

})

【问题讨论】:

  • 你的ui是什么?
  • 更重要的是,wordreact() 是在哪里定义的?
  • 你能帮我关闭这个吗?谢谢。

标签: r datatable shiny dt


【解决方案1】:

事实证明我能够在这个问题上回答我自己的问题。因为我试图在 Reactive 下测试它,所以我看不到输出。为了测试,我必须包含一个观察语句。太简单。事后。感谢 tobiaseli_te。

观察(打印(graphids()))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-10
    • 2019-10-24
    • 2020-10-27
    • 2017-03-03
    • 2018-12-02
    • 2019-08-14
    • 2020-10-21
    • 2017-09-10
    相关资源
    最近更新 更多