R:如何根据另一个主actionButton顺序生成actionButton
我试图根据actionButton的值为我的UI生成一些输入。生成textInputs工作正常(请参见下面的可复制代码),但生成actionButtons似乎很棘手 代码如下:R:如何根据另一个主actionButton顺序生成actionButton,r,shiny,R,Shiny,我试图根据actionButton的值为我的UI生成一些输入。生成textInputs工作正常(请参见下面的可复制代码),但生成actionButtons似乎很棘手 代码如下: shiny::runApp( list( ui = pageWithSidebar( headerPanel("test"), sidebarPanel( actionButton("create","create") ), mainPanel( uiOutput('the_textInputs'), uiO
shiny::runApp(
list(
ui = pageWithSidebar(
headerPanel("test"),
sidebarPanel(
actionButton("create","create")
),
mainPanel(
uiOutput('the_textInputs'),
uiOutput('the_buttons')
))
,
server = function(input,output){
observe({
if (input$create == 0)
return()
isolate({
output$the_textInputs <- renderText({ #this works nicely
A <- paste0("<input id='A", 1:input$create, "' class='shiny-bound-input' type='text' value=''>")
})
output$the_buttons <- renderUI({ # this does not work properly, probably due to the html commands here below not well specified
B <- paste0("<input id='B", 1:input$create, "' class='btn action-button' type='button' >")
})
})
})
}
))
shinny::runApp(
名单(
ui=页面带边框(
headerPanel(“测试”),
侧栏面板(
操作按钮(“创建”、“创建”)
),
主面板(
uiOutput('u textInputs'),
uiOutput(“_按钮”)
))
,
服务器=功能(输入、输出){
观察({
如果(输入$create==0)
返回()
孤立({
输出$the_textInputs在renderUI
中,您只能使用“返回闪亮标记对象、HTML或此类对象列表的表达式”
您必须为output$the_按钮进行更改非常感谢!它确实有效!只是一个额外的问题(对不起,请举例说明):我如何指定标签?这不起作用