【发布时间】:2016-03-22 16:31:03
【问题描述】:
我需要能够在闪亮的应用程序中并排添加 textInput()。应该有一个 textInput() ,它采用新文本框和命令按钮的标签,每次单击命令按钮时,都应将一个新文本框添加到列表中,该标签应从第一个 txtInput 中获取。
例如:
1stTextBox:[ Application ]
{commandButton}
当我点击commandButton时,我应该在commandButton下面有一个像这样的textInput,
Application:[ ]
如果我在 1stTextBox 中添加其他内容并单击命令按钮,则应将其添加到 textInput 列表中。
任何想法如何在闪亮的动态中做到这一点?
这是错误:
Listening on http://127.0.0.1:3091
Warning: Error in handlers$add: Key / already in use
Stack trace (innermost first):
43: handlers$add
42: handlerManager$addHandler
41: startApp
40: runApp
1: shiny::runApp
Error in handlers$add(handler, key, tail) : Key / already in use
【问题讨论】:
-
您的服务器代码中需要
observeEvent和renderUI的组合。observeEvent将监视按钮单击,然后使用renderUI绘制具有指定标签的第二个文本输入。 -
@warmoverflow,我对闪亮很陌生。你有什么例子吗?
-
这是我为另一个问题制作的示例。它观察 numericInput 的变化并呈现更多 numericInput。 stackoverflow.com/questions/36094718/r-shiny-dynamic-input/…