【问题标题】:how dynamically update html table on shiny app如何在闪亮的应用程序上动态更新 html 表
【发布时间】:2015-01-15 14:46:56
【问题描述】:

我想每次用户更改下面的参数“mass”时生成一个新的html表格,然后动态展示它

服务器.R

library(hwriter)
shinyServer(function(input, output) {

    output$distPlot <- renderText({
        mass <- as.numeric(input$mass) 
        win <- as.numeric(input$sswin) 
        m1 <- mass-win/2
        m2 <- mass+win/2


        etr <- paste0("http://rest.kegg.jp/find/compound/", m1, "-", m2, "/exact_mass")
        tb <- read.table(etr)  
        colnames(tb) <- c("id", "mass")

        #p <- openPage('test.html')
        tblk <- cbind(paste0("http://www.kegg.jp/dbget-bin/www_bget?", tb[,1]), NA)
        #hwrite(tb, p, link = tblk)
        hwrite(tb, link = tblk)
        #close(p)

      })


})

ui.R

library(shiny)

shinyUI(fluidPage(


  sidebarLayout(
    sidebarPanel(

           textInput("mass", "Mass:", "200.05"),
           textInput("sswin", "Search window:", "0.5")

    ),


    # Show a plot of the generated distribution
    mainPanel(

      #plotOutput("distPlot"),
      #includeHTML("test.html")
      uiOutput("distPlot")


    )
  )
))

表格正在生成,但我不知道如何更新它。

我想出了一个办法,并在上面进行了编辑。

【问题讨论】:

  • 我认为它被称为重新激活。见post
  • 感谢@CronAcronis,我想出了一个办法并改变了。

标签: r shiny


【解决方案1】:

我遇到了与 user1265067 完全相同的问题,我找到了解决问题的方法。

由于这个问题没有答案,并且如果其他用户偶然发现了这个线程,请在这个线程中找到我的解决方案(带有一个工作玩具示例):Shiny - populate static HTML table with filtered data based on input

简而言之,我将静态html表包装在一个函数中,在服务器中获取它并在renderUI()函数中调用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-19
    • 1970-01-01
    • 2020-09-30
    • 2018-12-29
    • 2023-01-26
    • 2017-12-05
    • 2016-08-01
    相关资源
    最近更新 更多