代码之家  ›  专栏  ›  技术社区  ›  Jamalan

单击actionbutton后的R only renderDataTable

  •  -1
  • Jamalan  · 技术社区  · 5 年前

    我希望用户单击一个按钮,然后调用renderDataTable函数

    这就是我现在要做的:

    UI具有以下功能:

    ui <- fluidPage(
     actionButton("tbl","Show Table"),
     DT::dataTableOutput("t_all")
    )
    
    

    服务器:

    server <- function(input, output){
    
    summary_table_RCT <- eventReactive(input$tbl, {summary_table})
    
    output$t_all <-
    DT::renderDataTable(
      summary_table_RCT(), 
      filter = 'top',
      class = "cell-border stripe",
      rownames = FALSE,
      extensions = c("FixedColumns"),
      options = list(searchHighlight = TRUE, 
                     regex = TRUE,
                     scrollX = TRUE,
                     fixedColumns = list(leftColumns = 5)) 
    )
    }
    
    shinyApp(ui, server)
    

    0 回复  |  直到 5 年前
        1
  •  0
  •   Jamalan    5 年前

    找到了答案,希望那些经历过同样挫折的人能在让他们发疯之前找到答案。但在应用程序的另一个选项卡中,另一个开发人员使用了submitButton(),它基本上会中断所有反应事件,直到按下按钮。应该只在非常简单的应用程序中使用,你只有一个按钮。

    推荐文章